Submission #376234

#TimeUsernameProblemLanguageResultExecution timeMemory
376234daniel920712Bitaro, who Leaps through Time (JOI19_timeleap)C++14
4 / 100
3057 ms17716 KiB
#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]; int main() { long long N,M,a,b,c,d,i,ans=0; scanf("%lld %lld",&N,&M); for(i=1;i<N;i++) { scanf("%lld %lld",&c,&d); how[i]=make_pair(c,d); } while(M--) { scanf("%lld",&a); if(a==1) { scanf("%lld %lld %lld",&b,&c,&d); how[b]=make_pair(c,d); } else { ans=0; scanf("%lld %lld %lld %lld",&a,&b,&c,&d); if(a<c) { for(i=a;i<c;i++) { if(b<how[i].first) b=how[i].first+1; else if(b>=how[i].second) { ans+=b-how[i].second+1; b=how[i].second; } else b++; } if(b>d) ans+=b-d; } else { for(i=a-1;i>=c;i--) { if(b<how[i].first) b=how[i].first+1; else if(b>=how[i].second) { ans+=b-how[i].second+1; b=how[i].second; } else b++; } if(b>d) ans+=b-d; } printf("%lld\n",ans); } } return 0; }

Compilation message (stderr)

timeleap.cpp: In function 'int main()':
timeleap.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |     scanf("%lld %lld",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
timeleap.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |         scanf("%lld %lld",&c,&d);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
timeleap.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |         scanf("%lld",&a);
      |         ~~~~~^~~~~~~~~~~
timeleap.cpp:24:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   24 |             scanf("%lld %lld %lld",&b,&c,&d);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
timeleap.cpp:30:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   30 |             scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...