# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48226 | 2018-05-10T23:59:16 Z | qkrghdqls1 | Boat (APIO16_boat) | C++14 | 2000 ms | 524288 KB |
#include<bits/stdc++.h> using namespace std; int a[501],b[501],mod=1000000007; vector<int> v; unordered_map<int,int> m; map<int,int> su; int main() { /*int n,cnt=1; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d %d",&a[i],&b[i]); v.push_back(a[i]); v.push_back(b[i]); } sort(v.begin(),v.end()); unique(v.begin(),v.end()); while(cnt<v.size()&&v[cnt-1]<v[cnt]) cnt++;*/ int n; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d %d",&a[i],&b[i]); for(int j=a[i];j<=b[i];j++) m[j]=0; } m[0]=1; int s=0; for(int i=0;i<n;i++){ s=0; for(auto it=m.begin();it!=m.end();it++){ s=(s+it->second)%mod; su[it->first]=s; } for(int j=b[i];j>=a[i];j--) { auto it=su.find(j); auto it2=m.find(j); it--; m[j]=(m[j]+it->second)%mod; } } s=0; for(auto it=m.begin();it!=m.end();it++){ s=(s+it->second)%mod; su[it->first]=s; } printf("%d",(s-1+mod)%mod); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2061 ms | 524288 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |