답안 #1071595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071595 2024-08-23T09:12:20 Z 김은성(#11136) Ancient Machine (JOI21_ancient_machine) C++17
70 / 100
66 ms 8552 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
void Anna(int N, std::vector<char> S) {
	int i, lo = N, hi = -1;
	vector<bool> ch(N);	//checked 1 if invalid
	for(i=0; i<N; i++){
		if(S[i] == 'X'){
			lo = i;
			break;
		}
	}
	for(i=N-1; i>=0; i--){
		if(S[i] == 'Z'){
			hi = i;
			break;
		}
	}
	for(i=0; i<lo; i++)
		ch[i] = 1;
	for(i=hi+1; i<N; i++)
		ch[i] = 1;
	vector<int> send;
	bool flag = 0;
	for(i=lo; i<=hi; i++){
		if(S[i] == 'Y')
			flag = 1;
	}
	if(!flag){
		for(i=0; i<N; i++)
			ch[i] = 1;
	}
	else{
		bool one = 1;
		for(i=lo; i<=hi; i++){
			if(one){
				if(S[i] == 'Y')
					ch[i] = 1;
				else if(S[i] == 'X'){
					send.push_back(0);
					one = 0;
				}
				else{
					send.push_back(1);
					one = 0;
				}
			}
			else{
				if(S[i] == 'Y')
					one = 1;
				else
					ch[i] = 1;
			}
		}
		for(i=hi; i>=lo; i--){
			if(!ch[i])
				break;
		}
		int idx = i;
		ch[idx] = 1;
		ch[hi] = 0;
		send.pop_back();
		send.push_back(1);
	}
	vector<int> eff;
	for(i=0; i<N; i++){
		if(!ch[i])
			eff.push_back(i);
	}
	for(i=0; i+1<eff.size()/2; i++){
		if(S[eff[2*i+2]] == 'Z')
			ch[eff[2*i+1]] = ch[eff[2*i+2]] = 1;
	}
	for(i=0; i<N; i++)
		Send(ch[i]);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
void Bruno(int N, int L, std::vector<int> A) {
	int i;
	vector<int> eff;	//value of eff[2*i] = A[n+i]
	//for(i=0; i<L; i++)
	//	printf("%d ", A[i]);
	//printf("\n");
	int hi = -1;
	for(i=0; i<N; i++){
		if(A[i])
			Remove(i);
		else
			hi = i;
	}
	for(i=hi-1; i>=0; i--){
		if(!A[i])
			Remove(i);
	}
	if(hi != -1)
		Remove(hi);
	return;
	for(i=0; i<N; i++){
		if(A[i])
			Remove(i);
		else
			eff.push_back(i);
	}
	if(eff.empty())
		return;
	vector<int> x;
	x.push_back(eff[0]);
	for(i=0; i+1<eff.size() / 2; i++){
		if(A[N+i+1] == 1){
			Remove(eff[2*i+1]);
			Remove(eff[2*i+2]);
		}
		else{
			x.push_back(eff[2*i+1]);
			x.push_back(eff[2*i+2]);
		}
	}
	x.push_back(eff[eff.size()-2]);
	while(!x.empty()){
		Remove(x.back());
		x.pop_back();
	}
	Remove(eff.back());
}

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:70:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |  for(i=0; i+1<eff.size()/2; i++){
      |           ~~~^~~~~~~~~~~~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:34:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  for(i=0; i+1<eff.size() / 2; i++){
      |           ~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 780 KB Output is correct
2 Correct 0 ms 1028 KB Output is correct
3 Correct 0 ms 792 KB Output is correct
4 Correct 0 ms 792 KB Output is correct
5 Correct 0 ms 792 KB Output is correct
6 Correct 1 ms 788 KB Output is correct
7 Correct 0 ms 856 KB Output is correct
8 Correct 0 ms 772 KB Output is correct
9 Correct 0 ms 788 KB Output is correct
10 Correct 0 ms 780 KB Output is correct
11 Correct 1 ms 792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 44 ms 8068 KB Partially correct
2 Partially correct 52 ms 7848 KB Partially correct
3 Partially correct 46 ms 8056 KB Partially correct
4 Partially correct 45 ms 8024 KB Partially correct
5 Partially correct 66 ms 7952 KB Partially correct
6 Partially correct 41 ms 8056 KB Partially correct
7 Partially correct 44 ms 8044 KB Partially correct
8 Partially correct 42 ms 8052 KB Partially correct
9 Partially correct 44 ms 8052 KB Partially correct
10 Partially correct 47 ms 8056 KB Partially correct
11 Partially correct 48 ms 8080 KB Partially correct
12 Partially correct 44 ms 8108 KB Partially correct
13 Partially correct 47 ms 8552 KB Partially correct
14 Partially correct 47 ms 8552 KB Partially correct
15 Partially correct 46 ms 8292 KB Partially correct
16 Partially correct 39 ms 8180 KB Partially correct
17 Partially correct 53 ms 7904 KB Partially correct
18 Partially correct 44 ms 7928 KB Partially correct
19 Partially correct 41 ms 7944 KB Partially correct
20 Partially correct 39 ms 8548 KB Partially correct
21 Partially correct 43 ms 8544 KB Partially correct
22 Partially correct 41 ms 8068 KB Partially correct
23 Partially correct 40 ms 8312 KB Partially correct
24 Partially correct 39 ms 8344 KB Partially correct
25 Partially correct 41 ms 7896 KB Partially correct
26 Partially correct 41 ms 8004 KB Partially correct
27 Partially correct 41 ms 7936 KB Partially correct
28 Partially correct 43 ms 7920 KB Partially correct
29 Partially correct 43 ms 8004 KB Partially correct
30 Partially correct 41 ms 7964 KB Partially correct
31 Partially correct 45 ms 7832 KB Partially correct
32 Partially correct 44 ms 8040 KB Partially correct
33 Partially correct 46 ms 7828 KB Partially correct