Submission #125714

# Submission time Handle Problem Language Result Execution time Memory
125714 2019-07-06T09:16:53 Z 김세빈(#3068) None (JOI16_ho_t5) C++14
34 / 100
2000 ms 6620 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

struct query{
	ll x, d, l;
	query() {}
	query(ll x, ll d, ll l) : x(x), d(d), l(l) {}
};

vector <query> Q;
ll n, q;

int main()
{
	ll i, j, x, y, d, l;
	
	scanf("%lld%lld", &n, &q);
	
	for(i=0; i<q; i++){
		scanf("%lld%lld%lld", &x, &d, &l);
		Q.emplace_back(x, d, l + l);
	}
	
	reverse(Q.begin(), Q.end());
	
	for(i=0; i<n; i++){
		x = i + 1; y = -i;
		for(j=0; j<q; j++){
			if(Q[j].d == 1){
				if(x <= Q[j].x){
					y += Q[j].l;
				}
			}
			else{
				if(y <= -Q[j].x){
					x += Q[j].l;
				}
			}
		}
		
		printf("%lld\n", x + y >> 1);
	}
	
	return 0;
}

Compilation message

2016_ho_t5.cpp: In function 'int main()':
2016_ho_t5.cpp:44:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   printf("%lld\n", x + y >> 1);
                    ~~^~~
2016_ho_t5.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &n, &q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
2016_ho_t5.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld%lld", &x, &d, &l);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 252 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 324 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 252 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 324 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 48 ms 504 KB Output is correct
29 Correct 31 ms 536 KB Output is correct
30 Correct 25 ms 532 KB Output is correct
31 Correct 57 ms 504 KB Output is correct
32 Correct 24 ms 504 KB Output is correct
33 Correct 46 ms 504 KB Output is correct
34 Correct 60 ms 504 KB Output is correct
35 Correct 33 ms 632 KB Output is correct
36 Correct 38 ms 504 KB Output is correct
37 Correct 43 ms 504 KB Output is correct
38 Correct 61 ms 528 KB Output is correct
39 Correct 55 ms 504 KB Output is correct
40 Correct 59 ms 544 KB Output is correct
41 Correct 61 ms 632 KB Output is correct
42 Correct 60 ms 504 KB Output is correct
43 Correct 45 ms 504 KB Output is correct
44 Correct 53 ms 504 KB Output is correct
45 Correct 49 ms 504 KB Output is correct
46 Correct 25 ms 508 KB Output is correct
47 Correct 25 ms 504 KB Output is correct
48 Correct 13 ms 504 KB Output is correct
49 Correct 13 ms 504 KB Output is correct
50 Correct 14 ms 632 KB Output is correct
51 Correct 14 ms 504 KB Output is correct
52 Correct 14 ms 504 KB Output is correct
53 Correct 13 ms 504 KB Output is correct
54 Correct 14 ms 504 KB Output is correct
55 Correct 13 ms 504 KB Output is correct
56 Correct 14 ms 504 KB Output is correct
57 Correct 14 ms 508 KB Output is correct
58 Correct 13 ms 504 KB Output is correct
59 Correct 13 ms 504 KB Output is correct
60 Correct 14 ms 504 KB Output is correct
61 Correct 14 ms 504 KB Output is correct
62 Correct 41 ms 504 KB Output is correct
63 Correct 36 ms 632 KB Output is correct
64 Correct 31 ms 564 KB Output is correct
65 Correct 31 ms 504 KB Output is correct
66 Correct 32 ms 528 KB Output is correct
67 Correct 32 ms 504 KB Output is correct
68 Correct 32 ms 504 KB Output is correct
69 Correct 32 ms 436 KB Output is correct
70 Correct 2 ms 256 KB Output is correct
71 Correct 2 ms 376 KB Output is correct
72 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 252 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 324 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 48 ms 504 KB Output is correct
29 Correct 31 ms 536 KB Output is correct
30 Correct 25 ms 532 KB Output is correct
31 Correct 57 ms 504 KB Output is correct
32 Correct 24 ms 504 KB Output is correct
33 Correct 46 ms 504 KB Output is correct
34 Correct 60 ms 504 KB Output is correct
35 Correct 33 ms 632 KB Output is correct
36 Correct 38 ms 504 KB Output is correct
37 Correct 43 ms 504 KB Output is correct
38 Correct 61 ms 528 KB Output is correct
39 Correct 55 ms 504 KB Output is correct
40 Correct 59 ms 544 KB Output is correct
41 Correct 61 ms 632 KB Output is correct
42 Correct 60 ms 504 KB Output is correct
43 Correct 45 ms 504 KB Output is correct
44 Correct 53 ms 504 KB Output is correct
45 Correct 49 ms 504 KB Output is correct
46 Correct 25 ms 508 KB Output is correct
47 Correct 25 ms 504 KB Output is correct
48 Correct 13 ms 504 KB Output is correct
49 Correct 13 ms 504 KB Output is correct
50 Correct 14 ms 632 KB Output is correct
51 Correct 14 ms 504 KB Output is correct
52 Correct 14 ms 504 KB Output is correct
53 Correct 13 ms 504 KB Output is correct
54 Correct 14 ms 504 KB Output is correct
55 Correct 13 ms 504 KB Output is correct
56 Correct 14 ms 504 KB Output is correct
57 Correct 14 ms 508 KB Output is correct
58 Correct 13 ms 504 KB Output is correct
59 Correct 13 ms 504 KB Output is correct
60 Correct 14 ms 504 KB Output is correct
61 Correct 14 ms 504 KB Output is correct
62 Correct 41 ms 504 KB Output is correct
63 Correct 36 ms 632 KB Output is correct
64 Correct 31 ms 564 KB Output is correct
65 Correct 31 ms 504 KB Output is correct
66 Correct 32 ms 528 KB Output is correct
67 Correct 32 ms 504 KB Output is correct
68 Correct 32 ms 504 KB Output is correct
69 Correct 32 ms 436 KB Output is correct
70 Correct 2 ms 256 KB Output is correct
71 Correct 2 ms 376 KB Output is correct
72 Correct 2 ms 376 KB Output is correct
73 Execution timed out 2036 ms 6620 KB Time limit exceeded
74 Halted 0 ms 0 KB -