Submission #1298434

#TimeUsernameProblemLanguageResultExecution timeMemory
1298434martin_011Cave (IOI13_cave)C++20
46 / 100
11 ms492 KiB
#include "cave.h"
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll int
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define str string
#define vd void
#define vb vector<bool>
#define F first
#define S second
#define lbr '\n'
#define all(x) x.begin(), x.end()
const ll INF = 1E15;


void exploreCave(int n) {
    int a[n], c[n];
    for (int i=0; i<n; i++) {
        a[i] = 0;
        c[i]=-1;
    }
    vb e(n, 0);
    ll p = tryCombination(a);
    for (int i=0; i<n; i++) {
        if (e[i])continue;
        if (p==-1) p = n;
        for (int j=0; j<n; j++) {
            if (c[j] != -1) continue;
            a[j] = 1;
            ll aux = tryCombination(a);
            if (aux == -1) aux = n;
            if (aux < p) {
                a[j]=0;
                c[j] = aux;
                e[aux] = 1;
                continue;
            }
            if (aux > p) {
                c[j] = p;
                e[p] = 1;
                p = aux;
                continue;
            }
            a[j]=0;
        }
    }
    answer(a, c);
}

Compilation message (stderr)

cave.cpp:17:16: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+15' to '2147483647' [-Woverflow]
   17 | const ll INF = 1E15;
      |                ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...