# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
84339 | 2018-11-14T12:31:49 Z | win11905 | Sails (IOI07_sails) | C++11 | 1000 ms | 7940 KB |
#include <bits/stdc++.h> #define long long long #define pii pair<int, int> #define x first #define y second using namespace std; const int N = 1e5+5; int n, h[N], k[N]; int num[N]; int main() { scanf("%d", &n); for(int i = 1; i <= n; ++i) scanf("%d %d", h+i, k+i); for(int i = n; i > 0; --i) { vector<pii> now; for(int j = 1; j <= h[i]; ++j) now.emplace_back(num[j], j); sort(now.begin(), now.end(), [&](const pii &a, const pii &b) { if(a.x == b.x) return a.y > b.y; return a.x < b.x; }); for(int j = 0; j < k[i]; ++j) num[now[j].y]++; } long ans = 0; for(int i = 1; i < N; ++i) if(num[i]) ans += 1ll * num[i] * (num[i] - 1) / 2; printf("%lld\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 668 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 668 KB | Output is correct |
2 | Correct | 2 ms | 700 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 812 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 820 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 342 ms | 936 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1083 ms | 1732 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1064 ms | 2252 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1063 ms | 3716 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1081 ms | 5660 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1074 ms | 6808 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1071 ms | 7940 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |