답안 #916732

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
916732 2024-01-26T12:11:51 Z Warinchai 동굴 (IOI13_cave) C++14
0 / 100
110 ms 564 KB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
int sans[5005];
int dans[5005];
int isans[5005];
int temp[5005];
vector<int>v;
/*void answer(int s[],int d[]){
    for(int i=0;i<s.size();i++)cout<<s[i]<<" ";
    cout<<"\n";
    for(int i=0;i<d.size();i++)cout<<d[i]<<" ";
}*/
void exploreCave(int N) {
    int ans[N]={};
    int door[N]={};
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++)temp[j]=0;
        for(int j=0;j<N;j++){
            if(isans[j])temp[j]=ans[j];
        }
        int on;
        if(tryCombination(temp)==i)on=1;
        else on=0;
        v.clear();
        for(int i=0;i<N;i++)if(isans[i])v.push_back(i);
        int st=0,en=v.size();int pos=0;
        while(st<=en){
            int m=(st+en)/2;
            for(int j=0;j<v.size();j++){
                temp[v[j]]=on^1;
            }
            for(int j=0;j<m;j++){
                temp[v[j]]=on;
            }
            if(tryCombination(temp)<=i){
                pos=m-1;
                en=m-1;
            }else{
                st=m+1;
            }
        }
        isans[pos]=1;
        ans[pos]=on;
        door[i]=pos;
    }
    answer(ans,door);
    /* ... */
}
/*int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++)cin>>sans[i];
    for(int i=0;i<n;i++)cin>>dans[i];
    exploreCave(n);
}*/

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:30:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             for(int j=0;j<v.size();j++){
      |                         ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 544 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 110 ms 564 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 544 KB Answer is wrong
2 Halted 0 ms 0 KB -