Submission #756070

#TimeUsernameProblemLanguageResultExecution timeMemory
756070SanguineChameleonSails (IOI07_sails)C++17
30 / 100
1087 ms2448 KiB
#include <bits/stdc++.h> using namespace std; void just_do_it(); int main() { #ifdef KAMIRULEZ freopen("kamirulez.inp", "r", stdin); freopen("kamirulez.out", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); just_do_it(); return 0; } const int maxn = 1e5 + 20; pair<int, int> a[maxn]; void just_do_it() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].first >> a[i].second; } sort(a + 1, a + n + 1); vector<int> q; for (int i = 1; i <= n; i++) { for (int j = 0; j < a[i].first - a[i - 1].first; j++) { q.push_back(0); } sort(q.begin(), q.end()); for (int j = 0; j < a[i].second; j++) { q[j]++; } } long long res = 0; for (auto x: q) { res += 1LL * x * (x - 1) / 2; } cout << res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...