Submission #928746


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define f first
#define s second
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define CLR(x)  memset(x,0,sizeof(x))
#define RESET(x,a) memset(x,a,sizeof(x))
#define pi pair<int,int>
#define pb push_back
#define mp make_pair
#define debug(x) cerr<<">value ("<<#x<<") : "<<x<<endl;

ll a[1005],b[1005];

int main()
{
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    int t,n,m,i,j;
    ll tot,c,d,e,f,x,y;
    si(n);
    for(i=0;i<n;i++)
    {
        sl(a[i]);
        sl(b[i]);
    }
    for(m=1;m<n;m++)
    {
    c=a[m];
    d=b[m];
    x=c;
    y=d;
    for(i=m-1;i>=0;i--)
    {
        e=a[i];
        f=b[i];
        if(c<e)
        {
            ll tim=(e-c)/x;
            if((e-c)%x)
                tim++;
            c=c+tim*x;
            d=d+tim*y;
        }
        if(d<f)
        {
            ll tim=(f-d)/y;
            if((f-d)%y)
                tim++;
            c=c+tim*x;
            d=d+tim*y;
        }
    }
    a[m]=c;
    b[m]=d;
    //printf("%lld %lld\n",c,d);
    }
    tot=a[n-1]+b[n-1];
    printf("%lld\n",tot);
    return 0;
}

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User aditya09
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1252 Byte
Status AC
Exec Time 3 ms
Memory 384 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     si(n);
          ^
./Main.cpp:27:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         sl(a[i]);
                 ^
./Main.cpp:28:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         sl(b[i]);
                 ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt
Case Name Status Exec Time Memory
0_000.txt AC 2 ms 256 KB
0_001.txt AC 2 ms 256 KB
0_002.txt AC 2 ms 256 KB
1_003.txt AC 2 ms 256 KB
1_004.txt AC 3 ms 256 KB
1_005.txt AC 2 ms 256 KB
1_006.txt AC 2 ms 256 KB
1_007.txt AC 2 ms 256 KB
1_008.txt AC 2 ms 256 KB
1_009.txt AC 2 ms 256 KB
1_010.txt AC 2 ms 256 KB
1_011.txt AC 2 ms 256 KB
1_012.txt AC 2 ms 384 KB
1_013.txt AC 3 ms 256 KB
1_014.txt AC 3 ms 256 KB