Submission #1055555

# Submission time Handle Problem Language Result Execution time Memory
1055555 2024-08-12T21:43:56 Z MrPavlito Cave (IOI13_cave) C++17
0 / 100
167 ms 524 KB
#include "cave.h"
#include <bits/stdc++.h>
//#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
#define endl "\n"
#define pii pair<int,int>

using namespace std;

const int MAXN = 5e3+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;


void exploreCave(int N) {
    int n = N;
    int trenutnacomb[n];
    int solved[n];
    for(int i=0; i<n; i++)trenutnacomb[i] = 0, solved[i] = 0;
    for(int i=0; i<n; i++)
    {
        int t = tryCombination(trenutnacomb);
        int l = 0;
        int r = n-1;
        while(l<r)
        {
            int mid = l+r >> 1;
            int pre[n];
            for(int i=0; i<n; i++)pre[i] = trenutnacomb[i];
            for(int i=l; i<= mid; i++)if(!solved[i])trenutnacomb[i] ^= 1;
            int p = tryCombination(trenutnacomb);
            bool pomoc;
            if(p == i && t == i)pomoc = true;
            else if(p != i && t == i)pomoc = false;
            else if(p == i && t !=i) pomoc = false;
            else pomoc = true;
            if(!pomoc)r = mid;
            else l = mid+1;
            for(int i=0; i<n; i++)trenutnacomb[i] = pre[i];
            t = p;
        }
        solved[i] = l;
        if(t == i)trenutnacomb[l] ^= 1;
    }
    answer(trenutnacomb, solved);

}

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:31:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   31 |             int mid = l+r >> 1;
      |                       ~^~
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 344 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 167 ms 524 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 24 ms 344 KB Answer is wrong
2 Halted 0 ms 0 KB -