-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_Fox_and_Box_Accumulation.cpp
73 lines (40 loc) · 1.06 KB
/
A_Fox_and_Box_Accumulation.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> v ;
bool check(vector<int> c){
for(int i = 0 ; i < c.size() ; i++){
// req of every ind element .....
}
}
bool isPossible(int target){
vector<int> heap [target] ;
int point = 0 ;
vector<pair<int,int>> temp ;
for(int i = target; i < v.size() ; i++){
temp.push_back(v[i]) ;
}
sort(temp.begin(),temp.end()) ;
stack<pair<int,int>> s ; for(auto &x:temp) s.push(x) ;
while (!s.empty())
{
auto e = s.top() ;
s.pop() ;
heap[point].push_back(e.first) ;
point++ ;
if(point>=target) point%= (target ) ;
}
for( int i = 0 ; i < target ; i++){
if( !check( heap[i] ) ) return false ;
}
} ;
int main(){
int n ; cin >> n ;
v.resize(n) ;
for(int i = 0 ; i < n ; i++){
cin >> v[i].first ;
v[i].second = i ;
}
sort(v.begin(),v.end()) ;
reverse(v.begin(),v.end()) ;
// for(int &x:v) cout << x << " " ;
}