# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
575458 | 2022-06-10T15:17:15 Z | keta_tsimakuridze | Sails (IOI07_sails) | C++17 | 1000 ms | 3000 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.begin(), v.end()); int m = 0; 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 j = 0; j < k; j++) { c[x[j].s]++; } m = max(m, v[i].f); } ll ans = 0; for(int i = 1; i <= m; i++) ans += (ll)c[i] * (c[i] - 1) / 2; cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 10 ms | 324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 314 ms | 380 KB | Output is correct |
2 | Execution timed out | 1085 ms | 1504 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1071 ms | 728 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1055 ms | 764 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1096 ms | 932 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1098 ms | 3000 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1055 ms | 1356 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1081 ms | 1408 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |