Submission #944606

# Submission time Handle Problem Language Result Execution time Memory
944606 2024-03-13T01:44:36 Z irmuun Cave (IOI13_cave) C++17
0 / 100
147 ms 604 KB
#include<bits/stdc++.h>
#include "cave.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

void exploreCave(int n){
    int s[n],d[n];
    vector<bool>used(n,0);
    for(int i=0;i<n;i++){
        vector<int>v;
        for(int j=0;j<n;j++){
            if(!used[j]){
                v.pb(j);
            }
        }
        int sz=v.size(),l=0,r=v.size()-1;
        for(int j=0;j<v.size();j++){
            s[v[j]]=0;
        }
        int x=tryCombination(s);
        int q=1,p=0;
        if(x==i){
            swap(q,p);
        }
        while(l<r){
            int mid=(l+r)/2;
            for(int j=0;j<sz;j++){
                if(j<=mid){
                    s[v[j]]=q;
                }
                else{
                    s[v[j]]=p;
                }
            }
            x=tryCombination(s);
            if(x==-1||x>i){
                r=mid;
            }
            else{
                l=mid+1;
            }
        }
        d[v[l]]=i;
        s[v[l]]=q;
        used[v[l]]=true;
    }
    answer(s,d);
}

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(int j=0;j<v.size();j++){
      |                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 92 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 147 ms 604 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 92 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -