답안 #129186

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
129186 2019-07-11T19:38:04 Z Mahmoud_Adel Bitaro, who Leaps through Time (JOI19_timeleap) C++14
4 / 100
8 ms 760 KB
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
const int N = 2005;
int n, q, t, p, s, e, a, b, c , d, l[N], r[N];
int main()
{
	cin >> n >> q;
	for(int i=0; i<n-1; i++) cin >> l[i] >> r[i];
	while(q--)
	{
		cin >> t;
		if(t == 1)
		{
			cin >> p >> s >> e;
			l[p-1] = s, r[p-1] = e;
		}
		else
		{
			cin >> a >> b >> c >> d;
			ll ans = 0;
			if(a < c)
			{
				for(int i=a-1; i<c-1; i++)
				{
					b = max(b, l[i]);
					if(b >= l[i] && b < r[i]) b++;
					else ans +=  b-r[i]+1, b = r[i];
				} 
			}
			else
			{
				for(int i=a-2; i>=c-1; i--)
				{
					//cout << b << " " << ans << endl;
					b = max(b, l[i]);
					if(b >= l[i] && b < r[i]) b++;
					else ans +=  b-r[i]+1, b = r[i];
				}
				//cout << "--------------------------\n";
			}
			cout << ans + max(0, b-d) << endl;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 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 7 ms 376 KB Output is correct
12 Correct 7 ms 376 KB Output is correct
13 Correct 7 ms 376 KB Output is correct
14 Correct 7 ms 504 KB Output is correct
15 Correct 8 ms 424 KB Output is correct
16 Correct 7 ms 376 KB Output is correct
17 Correct 7 ms 376 KB Output is correct
18 Correct 7 ms 376 KB Output is correct
19 Correct 7 ms 376 KB Output is correct
20 Correct 7 ms 376 KB Output is correct
21 Correct 7 ms 376 KB Output is correct
22 Correct 7 ms 504 KB Output is correct
23 Correct 7 ms 504 KB Output is correct
24 Correct 8 ms 376 KB Output is correct
25 Correct 8 ms 376 KB Output is correct
26 Correct 7 ms 456 KB Output is correct
27 Correct 7 ms 376 KB Output is correct
28 Correct 7 ms 376 KB Output is correct
29 Correct 8 ms 376 KB Output is correct
30 Correct 8 ms 376 KB Output is correct
31 Correct 7 ms 376 KB Output is correct
32 Correct 7 ms 376 KB Output is correct
33 Correct 7 ms 376 KB Output is correct
34 Correct 7 ms 376 KB Output is correct
35 Correct 7 ms 376 KB Output is correct
36 Correct 7 ms 376 KB Output is correct
37 Correct 7 ms 376 KB Output is correct
38 Correct 7 ms 380 KB Output is correct
39 Correct 7 ms 376 KB Output is correct
40 Correct 7 ms 376 KB Output is correct
41 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 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 7 ms 376 KB Output is correct
12 Correct 7 ms 376 KB Output is correct
13 Correct 7 ms 376 KB Output is correct
14 Correct 7 ms 504 KB Output is correct
15 Correct 8 ms 424 KB Output is correct
16 Correct 7 ms 376 KB Output is correct
17 Correct 7 ms 376 KB Output is correct
18 Correct 7 ms 376 KB Output is correct
19 Correct 7 ms 376 KB Output is correct
20 Correct 7 ms 376 KB Output is correct
21 Correct 7 ms 376 KB Output is correct
22 Correct 7 ms 504 KB Output is correct
23 Correct 7 ms 504 KB Output is correct
24 Correct 8 ms 376 KB Output is correct
25 Correct 8 ms 376 KB Output is correct
26 Correct 7 ms 456 KB Output is correct
27 Correct 7 ms 376 KB Output is correct
28 Correct 7 ms 376 KB Output is correct
29 Correct 8 ms 376 KB Output is correct
30 Correct 8 ms 376 KB Output is correct
31 Correct 7 ms 376 KB Output is correct
32 Correct 7 ms 376 KB Output is correct
33 Correct 7 ms 376 KB Output is correct
34 Correct 7 ms 376 KB Output is correct
35 Correct 7 ms 376 KB Output is correct
36 Correct 7 ms 376 KB Output is correct
37 Correct 7 ms 376 KB Output is correct
38 Correct 7 ms 380 KB Output is correct
39 Correct 7 ms 376 KB Output is correct
40 Correct 7 ms 376 KB Output is correct
41 Correct 2 ms 256 KB Output is correct
42 Runtime error 6 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
43 Halted 0 ms 0 KB -