답안 #242479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
242479 2020-06-27T19:38:15 Z MatesV13 Segway (COI19_segway) C++11
40 / 100
17 ms 1024 KB
#include <bits/stdc++.h>
using namespace std;
long long n, a[305], b[305], c[305];
long long m, x, seg[305], dp[305][305], poz[305], ubrz[305];
long long ubrzaj (int pozicija, int trenutak){
	int ret=0;
	for (int i=0; i<n; i++)
		if (dp[i][pozicija] and dp[i][pozicija]<trenutak) ret++;
	return (ret%20);
}
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n; for (int i=0; i<n; i++) cin >> a[i] >> b[i] >> c[i];
cin >> m; for (int i=0; i<m; i++){cin >> x; seg[x]++;} 
for (long long vrijeme=1; vrijeme<15005; vrijeme++){
	for (int i=0; i<n; i++){
		if (poz[i]>=300) continue;
		if (ubrz[i]){
			dp[i][poz[i]+1] = dp[i][poz[i]]+1;
			ubrz[i]--; poz[i]++;
			if (!ubrz[i] and seg[poz[i]]) 
				ubrz[i] = ubrzaj(poz[i], vrijeme);
		}
		else {
			if (poz[i]<100){
				if (vrijeme - dp[i][poz[i]] == a[i]){
					dp[i][poz[i]+1]=vrijeme;
					poz[i]++; 
					if (!ubrz[i] and seg[poz[i]]) 
						ubrz[i] = ubrzaj(poz[i], vrijeme);
				}
			}
			else if (poz[i]<200){
				if (vrijeme - dp[i][poz[i]] == b[i]){
					dp[i][poz[i]+1]=vrijeme;
					poz[i]++; 
					if (!ubrz[i] and seg[poz[i]]) 
						ubrz[i] = ubrzaj(poz[i], vrijeme);
				}
			}
			else {
				if (vrijeme - dp[i][poz[i]] == c[i]){
					dp[i][poz[i]+1]=vrijeme;
					poz[i]++; 
					if (!ubrz[i] and seg[poz[i]]) 
						ubrz[i] = ubrzaj(poz[i], vrijeme);
				}
			}
		}
	}
}
for (int i=0; i<n; i++) cout << dp[i][300] << endl;
return 0;
}
/*
2
1 2 3
4 5 6
0


3
5 5 5
6 2 10
10 9 2
2
100 199


5
2 2 2
6 6 6
8 8 8
9 9 9
10 10 10 
2
297 298


5
2 2 2
6 6 6
8 8 8
9 9 9
10 10 10
0
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 10 ms 896 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 6 ms 512 KB Output is correct
7 Correct 7 ms 512 KB Output is correct
8 Correct 11 ms 768 KB Output is correct
9 Correct 13 ms 832 KB Output is correct
10 Correct 15 ms 1024 KB Output is correct
11 Correct 17 ms 1004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 10 ms 896 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -