답안 #944660

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
944660 2024-03-13T02:47:55 Z yhkhoo 카멜레온의 사랑 (JOI20_chameleon) C++17
0 / 100
15 ms 480 KB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;

/* 
 * ladies and gentlemen
 * your attention please
 * the fire alarm has been activated in the building
 * we are investigating the situation
 * please remain calm and standby for further instruction
 * thank you
 * 
 * ladies and gentlemen
 * the emergency situation in the building is now under control
 * we regret any inconvenience caused
 * thank you
 */

void Solve(int N) {
    vector<int> l(N, -1), c(N, -1);
    vector<vector<int>> hm(2*N+1);
    for(int i=1; i<=2*N; i++){
        for(int j=1; j<=2*N; j++){
            if(j==i) continue;
            vector<int> s1 = {i, j};
            if(Query(s1) == 1){
                hm[i].push_back(j);
            }
        }
    }
	vector<vector<int>> cringe(2*N+1);
    for(int i=1; i<=2*N; i++){
        if(hm[i].size() == 0) continue;
        if(hm[i].size() == 1){
            Answer(i, hm[i].front());
            hm[hm[i].front()].clear();
        }
        else{
            for(int j=0; j<hm[i].size(); j++){
                vector<int> s2;
                for(int k=0; k<hm[i].size(); k++){
					if(k==j) continue;
					s2.push_back(hm[i][k]);
				}
				s2.push_back(i);
				if(Query(s2) == 1){
					cringe[hm[i][j]].push_back(i);
					cringe[i].push_back(hm[i][j]);
				}
			}
		}
	}
	for(int i=1; i<=2*N; i++){
		if(hm[i].size() == 3){
			for(int j=0; j<3; j++){
				if(!count(cringe[i].begin(), cringe[i].end(), hm[i][j])){
					if(hm[i][j] > i) continue;
					Answer(i, hm[i][j]);
					// hm[hm[i][j]].clear();
				}
			}
		}
	}
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:39:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             for(int j=0; j<hm[i].size(); j++){
      |                          ~^~~~~~~~~~~~~
chameleon.cpp:41:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |                 for(int k=0; k<hm[i].size(); k++){
      |                              ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Incorrect 0 ms 344 KB Wrong Answer [5]
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Incorrect 0 ms 344 KB Wrong Answer [5]
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 480 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -