Submission #1101251

#TimeUsernameProblemLanguageResultExecution timeMemory
1101251androSails (IOI07_sails)C++17
15 / 100
1068 ms2900 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> h(n + 1); vector<int> c(n + 1); for(int i = 1; i <= n; i++) { int u, v; cin >> u >> v; h[n - i + 1] = u; c[n - i + 1] = v; } int ans = 0; vector<int> M(n + 1, 0); for(int i = 1; i <= n; i++) { int br = 0; vector<int> mark(h[i] + 1, 0); while(c[i]--) { br += 1; //cout << "za :::" << i << "za" << br << " jedro stavljam na :::"; int mn = n + 1; for(int j = h[i]; j >= 1; j--) { if(mark[j]) { continue; } mn = min(mn, M[j]); } ans += mn; //cout << "stub ::: " << i << " za " << br << "jedro resenje min je::: {" << mn; for(int j = h[i]; j >= 1; j--) { if(mark[j]) { continue; } if(M[j] == mn) { M[j] += 1; mark[j] = 1; //cout << " " << j << "} \n"; break; } } } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...