Submission #376220

# Submission time Handle Problem Language Result Execution time Memory
376220 2021-03-11T04:42:56 Z daniel920712 Bitaro, who Leaps through Time (JOI19_timeleap) C++14
0 / 100
164 ms 54636 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>

using namespace std;
vector < pair < long long , long long > > Next[300005];
pair < long long , long long > how[300005];
long long F(long long here,long long fa,long long fin,long long x,long long y,long long z)
{
    //if(here<1) while(1);
    if(here==fin) printf("%lld\n",y+max((long long) 0,x-z));
    else
    {
        for(auto i:Next[here])
        {
            if(i.first==fa) continue;
            //if(i.first<1) while(1);
            if(x>=how[i.second].second) F(i.first,here,fin,how[i.second].second,y+x-how[i.second].second+1,z);
            else if(x<=how[i.second].first) F(i.first,here,fin,how[i.second].first+1,y,z);
            else F(i.first,here,fin,x+1,y,z);
        }
    }
}
int main()
{
    long long N,M,a,b,c,d,i;
    scanf("%lld %lld",&N,&M);
    //if(N>=100000) while(1);
    for(i=1;i<N;i++)
    {
        scanf("%lld %lld",&c,&d);
        Next[i].push_back(make_pair(i+1,i));
        Next[i+1].push_back(make_pair(i,i));
        how[i]=make_pair(c,d);
    }
    for(i=1;i<=N;i++) for(auto j:Next[i]) if(j.first<1) while(1);
    while(M--)
    {
        scanf("%lld",&a);
        if(a==1)
        {
            scanf("%lld %lld %lld",&b,&c,&d);
            how[b]=make_pair(c,d);
        }
        else
        {
            scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
            //if(a<1) while(1);
            F(a,-1,c,b,0,d);
        }
    }
    return 0;
}

Compilation message

timeleap.cpp: In function 'long long int F(long long int, long long int, long long int, long long int, long long int, long long int)':
timeleap.cpp:24:1: warning: no return statement in function returning non-void [-Wreturn-type]
   24 | }
      | ^
timeleap.cpp: In function 'int main()':
timeleap.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   28 |     scanf("%lld %lld",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
timeleap.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   32 |         scanf("%lld %lld",&c,&d);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
timeleap.cpp:40:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   40 |         scanf("%lld",&a);
      |         ~~~~~^~~~~~~~~~~
timeleap.cpp:43:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   43 |             scanf("%lld %lld %lld",&b,&c,&d);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
timeleap.cpp:48:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   48 |             scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 14700 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 164 ms 54636 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 14700 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -