답안 #419874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
419874 2021-06-07T14:53:12 Z Amylopectin Boat (APIO16_boat) C++14
9 / 100
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

boat.cpp: In function 'int main()':
boat.cpp:18:21: warning: unused variable 'm' [-Wunused-variable]
   18 |     long long i,j,n,m,f,t,ru,cou,su;
      |                     ^
boat.cpp:18:30: warning: unused variable 'cou' [-Wunused-variable]
   18 |     long long i,j,n,m,f,t,ru,cou,su;
      |                              ^~~
boat.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
boat.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         scanf("%lld %lld",&f,&t);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -