# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
419874 | 2021-06-07T14:53:12 Z | Amylopectin | Boat (APIO16_boat) | C++14 | 1 ms | 332 KB |
#include <iostream> #include <stdio.h> #include <algorithm> using namespace std; const long long mxn = 2010,mo = 1e9 + 7; struct sot { long long vaa,ind,sta; }; bool cmp(const struct sot &l,const struct sot &r) { return l.vaa < r.vaa; } struct sot so[mxn] = {}; long long rli[mxn] = {},poi[mxn][2] = {},vno[mxn] = {}; int main() { long long i,j,n,m,f,t,ru,cou,su; scanf("%lld",&n); for(i=0; i<n; i++) { scanf("%lld %lld",&f,&t); so[i*2] = {f-1,i,0}; so[i*2+1] = {t,i,1}; } sort(so,so+n*2,cmp); ru = 0; // cou = 0; // while(ru < n*2) // { // while() // } for(i=0; i<n*2; i++) { if(i == 0 || rli[ru-1] != so[i].vaa) { rli[ru] = so[i].vaa; poi[so[i].ind][so[i].sta] = ru; ru ++; } else { poi[so[i].ind][so[i].sta] = ru-1; } } for(i=0; i<n; i++) { su = 0; for(j=0; j<poi[i][1]; j++) { su += vno[j]; } vno[poi[i][1]] += (1 + su) * (rli[poi[i][1]] - rli[poi[i][1]-1]); vno[poi[i][1]] %= mo; for(j=poi[i][1]-1; j>poi[i][0]; j--) { su -= vno[j]; vno[j] += (1 + su) * (rli[j] - rli[j-1]); vno[j] %= mo; } } su = 0; for(i=0; i<ru; i++) { su += vno[i]; su %= mo; } printf("%lld\n",su); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 304 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 308 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 312 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 304 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 308 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 312 KB | Output is correct |
21 | Incorrect | 1 ms | 332 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 304 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 308 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 312 KB | Output is correct |
21 | Incorrect | 1 ms | 332 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |