# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
575457 | 2022-06-10T15:14:44 Z | keta_tsimakuridze | Sails (IOI07_sails) | C++14 | 1000 ms | 3252 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()); 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]++; } } 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 | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 312 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 | 328 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 295 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1080 ms | 812 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1083 ms | 792 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1093 ms | 960 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1057 ms | 3252 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1094 ms | 1376 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1098 ms | 1380 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |