# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
575456 | 2022-06-10T15:11:55 Z | keta_tsimakuridze | Sails (IOI07_sails) | C++17 | 1000 ms | 4596 KB |
#include<bits/stdc++.h> #define ll long long #define f first #define s second using namespace std; const int N = 2e5 + 5; int n, c[N]; int main() { cin >> n; vector<pair<int,int> > v; for(int i = 1; i <= n; i++) { int h, k; cin >> h >> k; v.push_back({h, k}); } sort(v.rbegin(), v.rend()); for(int i = 0; i < v.size(); i++) { int k = v[i].s; // pii mn = {n + 5, n + 5}; vector<pair<int,int> > x; for(int j = 1; j <= v[i].f; j++) { x.push_back({c[j], -j}); } sort(x.begin(), x.end()); for(int i = 0; i < k; i++) { c[-x[i].s]++; } } ll ans = 0; for(int i = 1; i <= n; i++) ans += (ll)c[i] * (c[i] - 1) / 2; cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 316 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 312 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 312 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 481 ms | 404 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1080 ms | 1240 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1086 ms | 1568 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1079 ms | 2560 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1054 ms | 4192 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1087 ms | 4380 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1076 ms | 4596 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |