Submission #282914

# Submission time Handle Problem Language Result Execution time Memory
282914 2020-08-25T07:17:12 Z 임성재(#5752) World of Tank (innopolis2018_final_E) C++17
0 / 100
1 ms 512 KB
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 1e9;
const ll INF = 1e18;

int n, m1, m2, t;
int a[5010][2];
int dp[5010][2];

int main() {
	fast;

	cin >> n >> m1 >> m2 >> t;

	for(int i=0; i<m1; i++) {
		int x;
		cin >> x;

		a[x][0] = 1;
	}

	for(int i=0; i<m2; i++) {
		int x;
		cin >> x;

		a[x][1] = 1;
	}

	dp[n+1][0] = dp[n+1][1] = n+1;

	for(int i=n; i>=0; i--) {
		if(!a[i+1][0]) dp[i][0] = max(dp[i][0], dp[i+1][0]);
		if(!a[i+1][1]) dp[i][1] = max(dp[i][1], dp[i+1][1]);

		if(!a[i][0] && !a[i+1][0]) dp[i][1] = max(dp[i][0], dp[i+1][0]);
		if(!a[i][1] && !a[i+1][1]) dp[i][0] = max(dp[i][1], dp[i+1][1]);
	}

	int y;
	vector<int> v, f;

	f.eb(0);
	
	for(int i=0; i<=n; i++) {
		if(dp[i][y] == i) {
			if(i >= f.back() + t) {
				f.eb(i);
				
				if(!a[i][1-y] && dp[i+1][y] < dp[i+1][1-y]) {
					v.eb(i);
					y = 1 - y;
				}
			}
			else {
				cout << "No\n";
				return 0;
			}
		}

		if(a[i+1][y]) {
			v.eb(i);
			y = 1 - y;
		}
	}

	cout << "Yes\n";

	cout << v.size() << "\n";
	for(auto i : v) {
		cout << i << " ";
	}  
	cout << "\n";

	cout << f.size() - 1 << "\n";
	for(auto i : f) {
		if(i == 0) continue;
		cout << i << " ";
	} 
}

Compilation message

E.cpp: In function 'int main()':
E.cpp:58:13: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   58 |   if(dp[i][y] == i) {
      |      ~~~~~~~^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -