Submission #242475

# Submission time Handle Problem Language Result Execution time Memory
242475 2020-06-27T19:31:17 Z MatesV13 Segway (COI19_segway) C++11
0 / 100
16 ms 768 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 (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 (poz[i]<300) {
				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;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 16 ms 768 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 7 ms 512 KB Output is correct
6 Correct 8 ms 640 KB Output is correct
7 Correct 9 ms 512 KB Output is correct
8 Incorrect 15 ms 768 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 16 ms 768 KB Output isn't correct
3 Halted 0 ms 0 KB -