Submission #1101253

#TimeUsernameProblemLanguageResultExecution timeMemory
1101253androSails (IOI07_sails)C++14
30 / 100
1068 ms5696 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<pair<int,int>> a(n + 1); for(int i = 1; i <= n; i++) { cin >> a[i].first >> a[i].second; } sort(a.begin() + 1, a.end()); vector<int> cnt(n + 1, 0); for(int i = 1; i <= n; i++) { vector<pair<int,int>> upd; for(int j = 1; j <= a[i].first; j++) { upd.push_back({cnt[j], j}); } sort(upd.begin(), upd.end()); for(int j = 0; j < a[i].second; j++) { cnt[upd[j].second] += 1; } } int ans = 0; for(int i = 1; i <= n; i++) { ans += cnt[i] * (cnt[i] - 1); } ans /= 2; cout << ans; }
#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...