답안 #283019

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283019 2020-08-25T08:39:56 Z 임성재(#5752) World of Tank (innopolis2018_final_E) C++17
20 / 100
96 ms 384 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 main() {
	fast;

	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;
	}

	for(int i=0; i < (1<<n); i++) {
		bool flag = true;

		vector<int> v;
		vector<pii> f;
		f.eb(0, 0);

		int y = 0;
		int l = 0;
		for(int j=0; j<n; j++) {
			if(i & (1 << j)) {
				if(a[j][1-y]) {
					flag = false;
					break;
				}

				v.eb(j);
				y = 1 - y;
				l = j;
			}

			if(a[j+1][y]) {
				if(j < f.back().fi + t) {
					flag = false;
					break;
				}

				f.eb(max(l, f.back().fi + t), y);
			}
		}

		f.erase(f.begin());

		if(flag) {
			cout << "Yes\n";

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

			cout << f.size() << "\n";
			for(auto i : f) {
				cout << i.fi << " " << i.se + 1 << "\n";
			}

			return 0;
		}
	}

	cout << "No";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20
2 Incorrect 1 ms 384 KB [No solution found] n = 5000, m1 = 509, m2 = 491, t = 5000
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20
2 Incorrect 1 ms 384 KB [No solution found] n = 5000, m1 = 509, m2 = 491, t = 5000
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 12, m2 = 9, t = 3
2 Correct 1 ms 384 KB [OK, Yes] n = 10, m1 = 4, m2 = 2, t = 2
3 Correct 0 ms 384 KB [OK, Yes] n = 10, m1 = 6, m2 = 0, t = 2
4 Correct 0 ms 384 KB [OK, Yes] n = 10, m1 = 2, m2 = 4, t = 1
5 Correct 96 ms 384 KB [OK, No] n = 20, m1 = 4, m2 = 11, t = 2
6 Correct 0 ms 384 KB [OK, Yes] n = 20, m1 = 7, m2 = 8, t = 1
7 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 7, m2 = 8, t = 2
8 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 0, m2 = 10, t = 2
9 Correct 0 ms 384 KB [OK, Yes] n = 20, m1 = 4, m2 = 6, t = 2
10 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 9, m2 = 1, t = 2
11 Correct 0 ms 384 KB [OK, Yes] n = 20, m1 = 10, m2 = 9, t = 2
12 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 9, m2 = 10, t = 2
13 Correct 0 ms 384 KB [OK, Yes] n = 20, m1 = 0, m2 = 0, t = 3
14 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 5, m2 = 4, t = 3
15 Correct 1 ms 384 KB [OK, Yes] n = 9, m1 = 4, m2 = 3, t = 3
16 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 8, m2 = 8, t = 3
17 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 9, m2 = 7, t = 3
18 Correct 5 ms 384 KB [OK, Yes] n = 20, m1 = 9, m2 = 10, t = 7
19 Correct 7 ms 384 KB [OK, Yes] n = 20, m1 = 7, m2 = 10, t = 8
20 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 13, m2 = 10, t = 4
21 Correct 3 ms 384 KB [OK, Yes] n = 20, m1 = 9, m2 = 9, t = 8
22 Correct 3 ms 384 KB [OK, Yes] n = 20, m1 = 10, m2 = 11, t = 3
23 Correct 42 ms 384 KB [OK, Yes] n = 20, m1 = 11, m2 = 11, t = 3
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20
2 Incorrect 1 ms 384 KB [No solution found] n = 5000, m1 = 509, m2 = 491, t = 5000
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20
2 Incorrect 1 ms 384 KB [No solution found] n = 5000, m1 = 509, m2 = 491, t = 5000
3 Halted 0 ms 0 KB -