Submission #1298417

#TimeUsernameProblemLanguageResultExecution timeMemory
1298417martin_011Cave (IOI13_cave)C++20
33 / 100
104 ms504 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;
    }
    ll p = tryCombination(a);
    for (int i=0; i<n; i++) {
        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 (p==i) {
                if (aux > p) {
                    c[j] = i;
                    break;
                }
            } else if (p>i) {
                if (aux==i) {
                    c[j]=i;
                    a[j]=0;
                    break;
                }
            }
            a[j]=0;
        }
        p = tryCombination(a);
    }
    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...