# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
26202 | 2017-06-28T10:50:28 Z | Extazy | Boat (APIO16_boat) | C++14 | 2000 ms | 209136 KB |
#include <bits/stdc++.h> using namespace std; const int N = 517; const int MOD = (1e9) + 7; int n; pair < int, int > a[N]; map < int, int > inside; map < int, int >::iterator it; int last; long long ans; int main() { int i,j; scanf("%d", &n); for(i=1;i<=n;i++) { scanf("%d %d", &a[i].first, &a[i].second); ++inside[a[i].first]; --inside[a[i].second+1]; } for(i=1;i<=n;i++) { for(j=a[i].first;j<=a[i].second;j++) if(inside.find(j)==inside.end()) inside.insert(make_pair(j,0)); } last=0; for(it=inside.begin();it!=inside.end();it++) { it->second+=last; it->second%=MOD; if(it->second) ans+=it->second+1; last=it->second; } ans%=MOD; printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2028 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2028 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2000 ms | 209136 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2028 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |