제출 #361395

#제출 시각아이디문제언어결과실행 시간메모리
361395NachoLibrePaint By Numbers (IOI16_paint)C++17
0 / 100
840 ms376 KiB
#include <bits/stdc++.h>
using namespace std;
#ifndef wambule
#include "paint.h"
#else
#endif

string solve_puzzle(string s, vector<int> c) {
	c.push_back(0);
	for(int i = 1; i <= 200000; ++i) {
		for(int j = 1; j <= 1000; ++j) {
			c[i % 2] += j % 5;
			swap(c[0], c[1]);
		}
	}
	return s;
	int n = s.size();
	int m = c.size();
	s = " " + s + " ";
	{
		vector<int> t = c;
		c.clear();
		c.push_back(0);
		for(int i = 0; i < (int)t.size(); ++i)
			c.push_back(t[i]);
		c.push_back(0);
	}
	bool cu[2][m + 2][n + 2];
	int qt[n + 2] = {0};
	qt[n + 1] = 0;
	for(int i = 1; i <= n; ++i) {
		qt[i] = qt[i - 1] + (s[i] == '_');
	}
	cu[0][0][0] = 1;
	for(int i = 1; i <= m; ++i) cu[0][i][0] = 0;
	for(int i = 1; i <= n; ++i) cu[0][0][i] = (cu[0][0][i - 1] && (s[i] != 'X'));
	for(int i = 1; i <= m; ++i) {
		for(int j = 1; j <= n; ++j) {
			cu[0][i][j] = 0;
			if(s[j] == '_') {
				cu[0][i][j] = cu[0][i][j - 1];
			} else if(s[j] == 'X') {
				if(c[i] <= j && qt[j] == qt[j - c[i]] && s[j - c[i]] != 'X') {
					if(c[i] < j) cu[0][i][j] |= cu[0][i - 1][j - c[i] - 1];
					else cu[0][i][j] |= (i == 1);
				}
			} else {
				cu[0][i][j] = cu[0][i][j - 1];
				if(c[i] <= j && qt[j] == qt[j - c[i]] && s[j - c[i]] != 'X') {
					if(c[i] < j) cu[0][i][j] |= cu[0][i - 1][j - c[i] - 1];
					else cu[0][i][j] |= (i == 1);
				}
			}
		}
	}
	//  //  //  //  //  //  //  //
	for(int i = n; i >= 1; --i)
		qt[i] = qt[i + 1] + (s[i] == '_');
	cu[1][m + 1][n + 1] = 1;
	for(int i = 1; i <= m; ++i) cu[1][i][n + 1] = 0;
	for(int i = n; i >= 1; --i) cu[1][m + 1][i] = (cu[1][m + 1][i + 1] && (s[i] != 'X'));
	for(int i = m; i >= 1; --i) {
		for(int j = n; j >= 1; --j) {
			cu[1][i][j] = 0;
			if(s[j] == '_') {
				cu[1][i][j] = cu[1][i][j + 1];
			} else if(s[j] == 'X') {
				if(c[i] <= n - j + 1 && qt[j] == qt[j + c[i]] && s[j + c[i]] != 'X') {
					if(c[i] < n - j + 1) cu[1][i][j] |= cu[1][i + 1][j + c[i] + 1];
					else cu[1][i][j] |= (i == m);
				}
			} else {
				cu[1][i][j] = cu[1][i][j + 1];
				if(c[i] <= n - j + 1 && qt[j] == qt[j + c[i]] && s[j + c[i]] != 'X') {
					if(c[i] < n - j + 1) cu[1][i][j] |= cu[1][i + 1][j + c[i] + 1];
					else cu[1][i][j] |= (i == m);
				}
			}
		}
	}
	//  //  //  //  //  //  //  //
	int fl[2][m + 2][n + 2];
	#ifdef wambule
	for(int i = 0; i <= m; ++i) {
		for(int j = 1; j <= n; ++j) {
			cout << cu[0][i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;
	for(int i = m + 1; i >= 1; --i) {
		for(int j = 1; j <= n; ++j) {
			cout << cu[1][i][j] << " ";
		}
		cout << endl;
	}
	#endif
	return s;
}

#ifdef wambule
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	// string s = solve_puzzle(".X.....X..", {1, 1});
	return 0;
}
#endif

컴파일 시 표준 에러 (stderr) 메시지

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:82:6: warning: unused variable 'fl' [-Wunused-variable]
   82 |  int fl[2][m + 2][n + 2];
      |      ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...