Submission #376234

# Submission time Handle Problem Language Result Execution time Memory
376234 2021-03-11T05:30:11 Z daniel920712 Bitaro, who Leaps through Time (JOI19_timeleap) C++14
4 / 100
3000 ms 17716 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];

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

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 time Memory Grader output
1 Correct 5 ms 7404 KB Output is correct
2 Correct 6 ms 7404 KB Output is correct
3 Correct 5 ms 7404 KB Output is correct
4 Correct 5 ms 7404 KB Output is correct
5 Correct 6 ms 7404 KB Output is correct
6 Correct 5 ms 7404 KB Output is correct
7 Correct 6 ms 7532 KB Output is correct
8 Correct 5 ms 7404 KB Output is correct
9 Correct 5 ms 7404 KB Output is correct
10 Correct 6 ms 7404 KB Output is correct
11 Correct 8 ms 7404 KB Output is correct
12 Correct 7 ms 7404 KB Output is correct
13 Correct 8 ms 7404 KB Output is correct
14 Correct 7 ms 7404 KB Output is correct
15 Correct 7 ms 7404 KB Output is correct
16 Correct 7 ms 7404 KB Output is correct
17 Correct 7 ms 7404 KB Output is correct
18 Correct 7 ms 7404 KB Output is correct
19 Correct 7 ms 7404 KB Output is correct
20 Correct 7 ms 7404 KB Output is correct
21 Correct 7 ms 7404 KB Output is correct
22 Correct 7 ms 7404 KB Output is correct
23 Correct 7 ms 7404 KB Output is correct
24 Correct 8 ms 7404 KB Output is correct
25 Correct 8 ms 7404 KB Output is correct
26 Correct 6 ms 7404 KB Output is correct
27 Correct 6 ms 7404 KB Output is correct
28 Correct 7 ms 7404 KB Output is correct
29 Correct 7 ms 7404 KB Output is correct
30 Correct 7 ms 7424 KB Output is correct
31 Correct 7 ms 7404 KB Output is correct
32 Correct 7 ms 7404 KB Output is correct
33 Correct 7 ms 7404 KB Output is correct
34 Correct 7 ms 7404 KB Output is correct
35 Correct 7 ms 7404 KB Output is correct
36 Correct 9 ms 7404 KB Output is correct
37 Correct 8 ms 7404 KB Output is correct
38 Correct 7 ms 7424 KB Output is correct
39 Correct 7 ms 7404 KB Output is correct
40 Correct 7 ms 7404 KB Output is correct
41 Correct 5 ms 7404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3057 ms 17716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7404 KB Output is correct
2 Correct 6 ms 7404 KB Output is correct
3 Correct 5 ms 7404 KB Output is correct
4 Correct 5 ms 7404 KB Output is correct
5 Correct 6 ms 7404 KB Output is correct
6 Correct 5 ms 7404 KB Output is correct
7 Correct 6 ms 7532 KB Output is correct
8 Correct 5 ms 7404 KB Output is correct
9 Correct 5 ms 7404 KB Output is correct
10 Correct 6 ms 7404 KB Output is correct
11 Correct 8 ms 7404 KB Output is correct
12 Correct 7 ms 7404 KB Output is correct
13 Correct 8 ms 7404 KB Output is correct
14 Correct 7 ms 7404 KB Output is correct
15 Correct 7 ms 7404 KB Output is correct
16 Correct 7 ms 7404 KB Output is correct
17 Correct 7 ms 7404 KB Output is correct
18 Correct 7 ms 7404 KB Output is correct
19 Correct 7 ms 7404 KB Output is correct
20 Correct 7 ms 7404 KB Output is correct
21 Correct 7 ms 7404 KB Output is correct
22 Correct 7 ms 7404 KB Output is correct
23 Correct 7 ms 7404 KB Output is correct
24 Correct 8 ms 7404 KB Output is correct
25 Correct 8 ms 7404 KB Output is correct
26 Correct 6 ms 7404 KB Output is correct
27 Correct 6 ms 7404 KB Output is correct
28 Correct 7 ms 7404 KB Output is correct
29 Correct 7 ms 7404 KB Output is correct
30 Correct 7 ms 7424 KB Output is correct
31 Correct 7 ms 7404 KB Output is correct
32 Correct 7 ms 7404 KB Output is correct
33 Correct 7 ms 7404 KB Output is correct
34 Correct 7 ms 7404 KB Output is correct
35 Correct 7 ms 7404 KB Output is correct
36 Correct 9 ms 7404 KB Output is correct
37 Correct 8 ms 7404 KB Output is correct
38 Correct 7 ms 7424 KB Output is correct
39 Correct 7 ms 7404 KB Output is correct
40 Correct 7 ms 7404 KB Output is correct
41 Correct 5 ms 7404 KB Output is correct
42 Execution timed out 3057 ms 17716 KB Time limit exceeded
43 Halted 0 ms 0 KB -