# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1004370 | 2024-06-21T08:21:16 Z | 0pt1mus23 | Kitchen (BOI19_kitchen) | C++14 | 23 ms | 4956 KB |
/* k=1 */ #pragma GCC optimize("O3", "inline") #include <bits/stdc++.h> using namespace std; #define ins insert #define pb push_back #define int long long int #define pii pair<int, int> #define endl '\n' #define drop(x) cout<<(x)<<endl; return; #define all(x) x.begin(),x.end() const int mod = 1e9 +7, sze = 1e5, inf = 2e18, prime = 23; int mn = inf; multiset<int> var[sze+1]; void mal(){ int n,m,k; cin>>n>>m>>k; vector<int> arr(n); for(int i=0;i<n;i++){ cin>>arr[i]; } vector<int> chefs(m); for(int i=0;i<m;i++){ cin>>chefs[i]; } multiset<int> bosda; for(auto v:chefs){ bosda.ins(v); } if(k==1){ /* i ci time da, bos olan yere bir dene adam ekle */ int ans=0; for(int i =1;i<=90000;i++){ for(int j=0;j<n;j++){ if(arr[j]){ while(!bosda.empty() && var[j].size()<arr[j]){ var[j].ins((*bosda.begin())); bosda.erase(bosda.begin()); } arr[j]-=var[j].size(); multiset<int> lst; for(auto v:var[j]){ if(v!=1){ lst.ins(v-1); } } while(!lst.empty() && arr[j]<lst.size()){ bosda.insert(*lst.begin()); lst.erase(lst.begin()); } var[j]=lst; } } ans+=bosda.size(); } for(int i=0;i<n;i++){ if(arr[i]){ // cout<<arr[i]<<endl; drop("Impossible"); } } // while(true){ // } drop(ans); } } signed main() { cin.tie(0)->sync_with_stdio(0); int tt = 1; // cin>>tt; while(tt--){ mal(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 4952 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |