# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
519640 | 2022-01-26T21:10:07 Z | sofapuden | Sails (IOI07_sails) | C++14 | 1000 ms | 2012 KB |
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n; cin >> n; vector<pair<int,int>> v(n); for(auto &x : v)cin >> x.first >> x.second; vector<int> S; S.push_back(1); sort(v.begin(),v.end()); for(int i = 0; i < n; ++i){ int z = v[i].second; int mx = v[i].first; int in = 0; while(z){ int am = min(z,mx-S[in]+1); z-=am; mx = S[in]-1; S[in] += am; in++; } if(S.back() != 1)S.push_back(1); } long long ans = 0; for(int i = 0; i < S.size(); ++i){ ans += 1ll * i * (S[i]-1); } cout << ans << '\n'; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 304 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 460 KB | Output is correct |
2 | Correct | 471 ms | 1080 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 640 ms | 1064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 540 ms | 1280 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 1688 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 2012 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1083 ms | 1856 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |