Submission #425224

# Submission time Handle Problem Language Result Execution time Memory
425224 2021-06-12T16:10:49 Z SAAD Cave (IOI13_cave) C++17
46 / 100
20 ms 420 KB
#define F first
#define S second
#define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1))
#define pb push_back
#define Fbitl __builtin_ffs
#define bit1 __builtin_popcount
//#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include "cave.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
void exploreCave(int N) {
    int com[N] , ans2[N] ;
    for(int i=0;i<N;i++) {
        com[i] = 0;
    }
    int c = 0 , a = 0 , mxa = 0 ;
    while ( true ) {
        a = tryCombination(com);
        if ( a == -1 ) break;
        mxa = max(a,mxa);
        a = mxa ;
        for ( int i = 0 ; i < N ; i++) {
            if ( com[i] ) continue;
            com[i] = 1 ;
            int b = tryCombination(com) ;
            if ( b > a || b == -1 ) {
                a = (b==-1?(int)1e5:b) ;
            } 
            else com[i] = 0 ;
        }
    }
    for ( int i = 0 ; i < N ; i++) {
        com[i] = (com[i]+1) % 2 ;
        ans2[i] = tryCombination(com);
        com[i] = (com[i]+1) % 2 ;
    }
    answer(com,ans2);
}

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:32:9: warning: unused variable 'c' [-Wunused-variable]
   32 |     int c = 0 , a = 0 , mxa = 0 ;
      |         ^
# Verdict Execution time Memory Grader output
1 Correct 14 ms 332 KB Output is correct
2 Correct 14 ms 400 KB Output is correct
3 Correct 20 ms 420 KB Output is correct
4 Correct 14 ms 332 KB Output is correct
5 Correct 11 ms 416 KB Output is correct
6 Correct 19 ms 416 KB Output is correct
7 Correct 20 ms 420 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 20 ms 332 KB Output is correct
13 Correct 20 ms 420 KB Output is correct
14 Correct 20 ms 416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 416 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 10 ms 420 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 11 ms 416 KB Output is correct
7 Correct 12 ms 416 KB Output is correct
8 Correct 16 ms 416 KB Output is correct
9 Correct 15 ms 420 KB Output is correct
10 Correct 14 ms 312 KB Output is correct
11 Correct 11 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 292 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 292 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Incorrect 4 ms 332 KB too much calls on tryCombination()
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 332 KB Output is correct
2 Correct 14 ms 400 KB Output is correct
3 Correct 20 ms 420 KB Output is correct
4 Correct 14 ms 332 KB Output is correct
5 Correct 11 ms 416 KB Output is correct
6 Correct 19 ms 416 KB Output is correct
7 Correct 20 ms 420 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 20 ms 332 KB Output is correct
13 Correct 20 ms 420 KB Output is correct
14 Correct 20 ms 416 KB Output is correct
15 Correct 11 ms 416 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 10 ms 420 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 11 ms 416 KB Output is correct
21 Correct 12 ms 416 KB Output is correct
22 Correct 16 ms 416 KB Output is correct
23 Correct 15 ms 420 KB Output is correct
24 Correct 14 ms 312 KB Output is correct
25 Correct 11 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 292 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Incorrect 4 ms 332 KB too much calls on tryCombination()
46 Halted 0 ms 0 KB -