답안 #428051

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
428051 2021-06-15T07:40:24 Z Amylopectin 송금 (JOI19_remittance) C++14
0 / 100
1 ms 204 KB
#include <iostream>
#include <stdio.h>
using namespace std;
const long long mxn = 1e6 + 10;
long long be[mxn] = {},af[mxn] = {},tw[mxn] = {};
long long fima(long long l,long long r)
{
    if(l > r)
        return l;
    return r;
}
int main()
{
    long long i,j,n,m,cma = 0,fr = 0,cva = 0;
    scanf("%lld",&n);
    for(i=0; i<n; i++)
    {
        scanf("%lld %lld",&be[i],&af[i]);
        cma = fima(cma,be[i] - af[i]);
    }
    tw[0] = 1;
    for(i=1; i<40; i++)
    {
        tw[i] = tw[i-1] * 2;
        if(tw[i] > cma)
        {
            break;
        }
    }
    for(i=n-1; i>=0; i--)
    {
        cva += be[i] - af[i];
        while(cva > 0 && fr < i)
        {
            cva += (be[fr] - af[fr]) * tw[n-i + fr];
            fr ++;
        }
        if(fr == i)
        {
            break;
        }
        cva *= 2;
    }
    if(cva == 0)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:14:17: warning: unused variable 'j' [-Wunused-variable]
   14 |     long long i,j,n,m,cma = 0,fr = 0,cva = 0;
      |                 ^
remittance.cpp:14:21: warning: unused variable 'm' [-Wunused-variable]
   14 |     long long i,j,n,m,cma = 0,fr = 0,cva = 0;
      |                     ^
remittance.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
remittance.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%lld %lld",&be[i],&af[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -