답안 #1042564

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1042564 2024-08-03T07:15:27 Z Unforgettablepl Tricolor Lights (JOI24_tricolor) C++17
10 / 100
61 ms 1800 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

namespace {

string calc(vector<int> arr,string S){
	int N = arr.size()+1;
	string res(N,'$');
	for(int i=0;i<N-1;i++){
		if(arr[i])continue;
		vector<bool> present(3);
		if(S[i]=='R')present[0]=true;
		else if(S[i]=='G')present[1]=true;
		else if(S[i]=='B')present[2]=true;
		if(S[i+1]=='R')present[0]=true;
		else if(S[i+1]=='G')present[1]=true;
		else if(S[i+1]=='B')present[2]=true;
		if(!present[0])res[i]=res[i+1]='R';
		else if(!present[1])res[i]=res[i+1]='G';
		else if(!present[2])res[i]=res[i+1]='B';
		for(int j=i-1;j>=0;j--){
			if(arr[j]!=1)break;
			vector<bool> present(3);
			if(S[j]=='R')present[0]=true;
			else if(S[j]=='G')present[1]=true;
			else if(S[j]=='B')present[2]=true;
			if(res[j+1]=='R')present[0]=true;
			else if(res[j+1]=='G')present[1]=true;
			else if(res[j+1]=='B')present[2]=true;
			if(!present[0])res[j]='R';
			else if(!present[1])res[j]='G';
			else if(!present[2])res[j]='B';
		}
		for(int j=i+2;j<N;j++){
			if(arr[j-1]!=1)break;
			vector<bool> present(3);
			if(S[j]=='R')present[0]=true;
			else if(S[j]=='G')present[1]=true;
			else if(S[j]=='B')present[2]=true;
			if(res[j-1]=='R')present[0]=true;
			else if(res[j-1]=='G')present[1]=true;
			else if(res[j-1]=='B')present[2]=true;
			if(!present[0])res[j]='R';
			else if(!present[1])res[j]='G';
			else if(!present[2])res[j]='B';	
		}
	}
	for(int i=0;i<N;i++)assert(res[i]!='$');
	return res;
}

}

pair<string, int> anna(int N, string S) {
	if(N<=130){
		string res;
		for(int i=0;i<N;i++){
			if(S[i]=='R')res.insert(res.end(),'B');
			else if(S[i]=='B')res.insert(res.end(),'G');
			else if(S[i]=='G')res.insert(res.end(),'R');
		}
		return {res,N};
	}
	vector<int> res(N-1,1);
	res[125]=0;
	return {calc(res,S),130};
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;

namespace {

int N;
int l;

}  // namespace

void init(int N, int l) {
	::N = N;
	::l = l;
}

int bruno(string u) {
	if(N<=130)return 1;
	int idxatsame = -1;
	for(int i=1;i<l;i++)if(u[i]==u[i-1])idxatsame=i-1;
	assert(idxatsame!=-1);
	return 126-idxatsame;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 1320 KB Output is correct
2 Correct 23 ms 1328 KB Output is correct
3 Correct 26 ms 1320 KB Output is correct
4 Correct 40 ms 1308 KB Output is correct
5 Correct 29 ms 1360 KB Output is correct
6 Correct 30 ms 1368 KB Output is correct
7 Correct 30 ms 1316 KB Output is correct
8 Correct 46 ms 1312 KB Output is correct
9 Correct 39 ms 1332 KB Output is correct
10 Correct 24 ms 1324 KB Output is correct
11 Correct 26 ms 1336 KB Output is correct
12 Correct 29 ms 1412 KB Output is correct
13 Correct 27 ms 1320 KB Output is correct
14 Correct 29 ms 1336 KB Output is correct
15 Correct 26 ms 1396 KB Output is correct
16 Correct 28 ms 1320 KB Output is correct
17 Correct 48 ms 1384 KB Output is correct
18 Correct 35 ms 1324 KB Output is correct
19 Correct 52 ms 1336 KB Output is correct
20 Correct 25 ms 1380 KB Output is correct
21 Correct 27 ms 1288 KB Output is correct
22 Correct 32 ms 1312 KB Output is correct
23 Correct 29 ms 1288 KB Output is correct
24 Correct 30 ms 1288 KB Output is correct
25 Correct 43 ms 1344 KB Output is correct
26 Correct 30 ms 1316 KB Output is correct
27 Correct 26 ms 1552 KB Output is correct
28 Correct 28 ms 1304 KB Output is correct
29 Correct 36 ms 1504 KB Output is correct
30 Correct 33 ms 1312 KB Output is correct
31 Correct 55 ms 1352 KB Output is correct
32 Correct 31 ms 1316 KB Output is correct
33 Correct 30 ms 1292 KB Output is correct
34 Correct 23 ms 1296 KB Output is correct
35 Correct 25 ms 1324 KB Output is correct
36 Correct 27 ms 1288 KB Output is correct
37 Correct 27 ms 1316 KB Output is correct
38 Correct 28 ms 1300 KB Output is correct
39 Correct 50 ms 1380 KB Output is correct
40 Correct 28 ms 1288 KB Output is correct
41 Correct 30 ms 1348 KB Output is correct
42 Correct 29 ms 1384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 1320 KB Output is correct
2 Correct 23 ms 1328 KB Output is correct
3 Correct 26 ms 1320 KB Output is correct
4 Correct 40 ms 1308 KB Output is correct
5 Correct 29 ms 1360 KB Output is correct
6 Correct 30 ms 1368 KB Output is correct
7 Correct 30 ms 1316 KB Output is correct
8 Correct 46 ms 1312 KB Output is correct
9 Correct 39 ms 1332 KB Output is correct
10 Correct 24 ms 1324 KB Output is correct
11 Correct 26 ms 1336 KB Output is correct
12 Correct 29 ms 1412 KB Output is correct
13 Correct 27 ms 1320 KB Output is correct
14 Correct 29 ms 1336 KB Output is correct
15 Correct 26 ms 1396 KB Output is correct
16 Correct 28 ms 1320 KB Output is correct
17 Correct 48 ms 1384 KB Output is correct
18 Correct 35 ms 1324 KB Output is correct
19 Correct 52 ms 1336 KB Output is correct
20 Correct 25 ms 1380 KB Output is correct
21 Correct 27 ms 1288 KB Output is correct
22 Correct 32 ms 1312 KB Output is correct
23 Correct 29 ms 1288 KB Output is correct
24 Correct 30 ms 1288 KB Output is correct
25 Correct 43 ms 1344 KB Output is correct
26 Correct 30 ms 1316 KB Output is correct
27 Correct 26 ms 1552 KB Output is correct
28 Correct 28 ms 1304 KB Output is correct
29 Correct 36 ms 1504 KB Output is correct
30 Correct 33 ms 1312 KB Output is correct
31 Correct 55 ms 1352 KB Output is correct
32 Correct 31 ms 1316 KB Output is correct
33 Correct 30 ms 1292 KB Output is correct
34 Correct 23 ms 1296 KB Output is correct
35 Correct 25 ms 1324 KB Output is correct
36 Correct 27 ms 1288 KB Output is correct
37 Correct 27 ms 1316 KB Output is correct
38 Correct 28 ms 1300 KB Output is correct
39 Correct 50 ms 1380 KB Output is correct
40 Correct 28 ms 1288 KB Output is correct
41 Correct 30 ms 1348 KB Output is correct
42 Correct 29 ms 1384 KB Output is correct
43 Correct 29 ms 1288 KB Output is correct
44 Correct 31 ms 1360 KB Output is correct
45 Correct 31 ms 1304 KB Output is correct
46 Correct 31 ms 1396 KB Output is correct
47 Correct 30 ms 1376 KB Output is correct
48 Correct 30 ms 1288 KB Output is correct
49 Correct 61 ms 1312 KB Output is correct
50 Correct 31 ms 1344 KB Output is correct
51 Correct 31 ms 1384 KB Output is correct
52 Correct 32 ms 1572 KB Output is correct
53 Correct 31 ms 1312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 1320 KB Output is correct
2 Correct 23 ms 1328 KB Output is correct
3 Correct 26 ms 1320 KB Output is correct
4 Correct 40 ms 1308 KB Output is correct
5 Correct 29 ms 1360 KB Output is correct
6 Correct 30 ms 1368 KB Output is correct
7 Correct 30 ms 1316 KB Output is correct
8 Correct 46 ms 1312 KB Output is correct
9 Correct 39 ms 1332 KB Output is correct
10 Correct 24 ms 1324 KB Output is correct
11 Correct 26 ms 1336 KB Output is correct
12 Correct 29 ms 1412 KB Output is correct
13 Correct 27 ms 1320 KB Output is correct
14 Correct 29 ms 1336 KB Output is correct
15 Correct 26 ms 1396 KB Output is correct
16 Correct 28 ms 1320 KB Output is correct
17 Correct 48 ms 1384 KB Output is correct
18 Correct 35 ms 1324 KB Output is correct
19 Correct 52 ms 1336 KB Output is correct
20 Correct 25 ms 1380 KB Output is correct
21 Correct 27 ms 1288 KB Output is correct
22 Correct 32 ms 1312 KB Output is correct
23 Correct 29 ms 1288 KB Output is correct
24 Correct 30 ms 1288 KB Output is correct
25 Correct 43 ms 1344 KB Output is correct
26 Correct 30 ms 1316 KB Output is correct
27 Correct 26 ms 1552 KB Output is correct
28 Correct 28 ms 1304 KB Output is correct
29 Correct 36 ms 1504 KB Output is correct
30 Correct 33 ms 1312 KB Output is correct
31 Correct 55 ms 1352 KB Output is correct
32 Correct 31 ms 1316 KB Output is correct
33 Correct 30 ms 1292 KB Output is correct
34 Correct 23 ms 1296 KB Output is correct
35 Correct 25 ms 1324 KB Output is correct
36 Correct 27 ms 1288 KB Output is correct
37 Correct 27 ms 1316 KB Output is correct
38 Correct 28 ms 1300 KB Output is correct
39 Correct 50 ms 1380 KB Output is correct
40 Correct 28 ms 1288 KB Output is correct
41 Correct 30 ms 1348 KB Output is correct
42 Correct 29 ms 1384 KB Output is correct
43 Correct 29 ms 1288 KB Output is correct
44 Correct 31 ms 1360 KB Output is correct
45 Correct 31 ms 1304 KB Output is correct
46 Correct 31 ms 1396 KB Output is correct
47 Correct 30 ms 1376 KB Output is correct
48 Correct 30 ms 1288 KB Output is correct
49 Correct 61 ms 1312 KB Output is correct
50 Correct 31 ms 1344 KB Output is correct
51 Correct 31 ms 1384 KB Output is correct
52 Correct 32 ms 1572 KB Output is correct
53 Correct 31 ms 1312 KB Output is correct
54 Runtime error 2 ms 1544 KB Execution killed with signal 6
55 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 1320 KB Output is correct
2 Correct 23 ms 1328 KB Output is correct
3 Correct 26 ms 1320 KB Output is correct
4 Correct 40 ms 1308 KB Output is correct
5 Correct 29 ms 1360 KB Output is correct
6 Correct 30 ms 1368 KB Output is correct
7 Correct 30 ms 1316 KB Output is correct
8 Correct 46 ms 1312 KB Output is correct
9 Correct 39 ms 1332 KB Output is correct
10 Correct 24 ms 1324 KB Output is correct
11 Correct 26 ms 1336 KB Output is correct
12 Correct 29 ms 1412 KB Output is correct
13 Correct 27 ms 1320 KB Output is correct
14 Correct 29 ms 1336 KB Output is correct
15 Correct 26 ms 1396 KB Output is correct
16 Correct 28 ms 1320 KB Output is correct
17 Correct 48 ms 1384 KB Output is correct
18 Correct 35 ms 1324 KB Output is correct
19 Correct 52 ms 1336 KB Output is correct
20 Correct 25 ms 1380 KB Output is correct
21 Correct 27 ms 1288 KB Output is correct
22 Correct 32 ms 1312 KB Output is correct
23 Correct 29 ms 1288 KB Output is correct
24 Correct 30 ms 1288 KB Output is correct
25 Correct 43 ms 1344 KB Output is correct
26 Correct 30 ms 1316 KB Output is correct
27 Correct 26 ms 1552 KB Output is correct
28 Correct 28 ms 1304 KB Output is correct
29 Correct 36 ms 1504 KB Output is correct
30 Correct 33 ms 1312 KB Output is correct
31 Correct 55 ms 1352 KB Output is correct
32 Correct 31 ms 1316 KB Output is correct
33 Correct 30 ms 1292 KB Output is correct
34 Correct 23 ms 1296 KB Output is correct
35 Correct 25 ms 1324 KB Output is correct
36 Correct 27 ms 1288 KB Output is correct
37 Correct 27 ms 1316 KB Output is correct
38 Correct 28 ms 1300 KB Output is correct
39 Correct 50 ms 1380 KB Output is correct
40 Correct 28 ms 1288 KB Output is correct
41 Correct 30 ms 1348 KB Output is correct
42 Correct 29 ms 1384 KB Output is correct
43 Correct 29 ms 1288 KB Output is correct
44 Correct 31 ms 1360 KB Output is correct
45 Correct 31 ms 1304 KB Output is correct
46 Correct 31 ms 1396 KB Output is correct
47 Correct 30 ms 1376 KB Output is correct
48 Correct 30 ms 1288 KB Output is correct
49 Correct 61 ms 1312 KB Output is correct
50 Correct 31 ms 1344 KB Output is correct
51 Correct 31 ms 1384 KB Output is correct
52 Correct 32 ms 1572 KB Output is correct
53 Correct 31 ms 1312 KB Output is correct
54 Runtime error 2 ms 1544 KB Execution killed with signal 6
55 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 1360 KB Output is correct
2 Correct 35 ms 1312 KB Output is correct
3 Correct 29 ms 1308 KB Output is correct
4 Correct 27 ms 1364 KB Output is correct
5 Partially correct 30 ms 1328 KB Partially correct
6 Partially correct 31 ms 1320 KB Partially correct
7 Partially correct 30 ms 1312 KB Partially correct
8 Partially correct 53 ms 1308 KB Partially correct
9 Partially correct 49 ms 1324 KB Partially correct
10 Partially correct 55 ms 1328 KB Partially correct
11 Runtime error 1 ms 1800 KB Execution killed with signal 6
12 Halted 0 ms 0 KB -