# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
26201 | 2017-06-28T10:43:12 Z | Extazy | Boat (APIO16_boat) | C++14 | 6 ms | 34792 KB |
#include <bits/stdc++.h> using namespace std; const int N = 517; const int MOD = (1e9) + 7; int n; pair < int, int > a[N]; int mn; int arr[1<<20]; vector < int > v[1<<20]; int inside[1<<20]; long long ans; int main() { int i,j; scanf("%d", &n); mn=1000000007; for(i=1;i<=n;i++) { scanf("%d %d", &a[i].first, &a[i].second); mn=min(mn,a[i].first-1); } for(i=1;i<=n;i++) { a[i].first-=mn; a[i].second-=mn; v[a[i].first].push_back(a[i].second); ++inside[a[i].first]; --inside[a[i].second+1]; } for(i=1;i<=1000001;i++) { inside[i]+=inside[i-1]; if(inside[i]) ans+=inside[i]+1; } /*for(i=1;i<=1000001;i++) { if(inside[i]) printf("Adding %d\n", arr[i-1]+1),ans+=arr[i-1]+1; arr[i]+=arr[i-1]; for(j=0;j<(int)(v[i].size());j++) printf("Increase %d and decrease %d\n", i, v[i][j]+1),++arr[i],--arr[v[i][j]+1],arr[v[i][j]+1]+=MOD,arr[v[i][j]+1]%=MOD; arr[i]%=MOD; }*/ ans%=MOD; printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 34792 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 34792 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 34792 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 34792 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |