Submission #277534

#TimeUsernameProblemLanguageResultExecution timeMemory
277534jainbot27동굴 (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
include <caves.h>
using namespace std;
//okay so you cant actually use tryCombination 70k times
/*
int tryCombination(vector<int> a){
    for(int i:a){
        cout << i << " ";
    }
    cout << endl;
    int x; cin >> x;
    return x;
}
*/

void answer(vector<int> s, vector<int> d){
    
}

void exploreCave(int n){
    vector<int> cur(n,0), done(n,0), ans(n,0), ans2(n, 0);
    for(int i=0; i < n; i++){
        vector<int> mirror = cur;
        if(tryCombination(mirror) == i){
            for(int j = 0; j < n; j++){
                if(!done[j])
                    cur[j] ^=1;
            }
        }
        mirror = cur;
        int lo = 0, hi = n-1;
        while(lo < hi){
            int mid = (lo + hi)/2;
            for(int j = lo; j <= mid; j++){
                if(!done[j])
                    mirror[j] ^= 1;
            }
            //cerr << "LO " << lo << " HI " << hi << endl;
            int x = tryCombination(mirror);
            if(x != i){
                //for(int j = lo; j <= mid; j++){
                    //if(!done[j])
                        //mirror[j]^=1;
                //}
                lo = mid + 1;
            }
            else{
                //for(int j = mid + 1; j <= hi; j++){
                    //if(!done[j])
                        //mirror[j]^=1;
                //}
                hi = mid;
            }
            mirror = cur;
        }
        //cerr << "LO " << lo << endl;
        //for(int j=0; j <n; j++){
            //cerr << mirror[j] << " ";
        //}
        //cerr << endl;
        //cur[lo] ^= 1;
        done[lo] = 1;
        ans[lo] = i;
        ans2[lo] = cur[lo];
        //cerr << "NEW" << endl;
    }
    //for(int i=0; i < n; i++){
        //cout << ans[i] << " " << ans2[i] << endl;
    //}
    answer(ans2, ans);
    exit(0);
}

/*
int main(){
    exploreCave(4);
}
*/

Compilation message (stderr)

cave.cpp:2:1: error: 'include' does not name a type
    2 | include <caves.h>
      | ^~~~~~~
cave.cpp:16:13: error: variable or field 'answer' declared void
   16 | void answer(vector<int> s, vector<int> d){
      |             ^~~~~~
cave.cpp:16:13: error: 'vector' was not declared in this scope
cave.cpp:16:13: note: suggested alternatives:
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from cave.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note:   'std::vector'
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from cave.cpp:1:
/usr/include/c++/9/vector:90:13: note:   'std::pmr::vector'
   90 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
cave.cpp:16:20: error: expected primary-expression before 'int'
   16 | void answer(vector<int> s, vector<int> d){
      |                    ^~~
cave.cpp:16:28: error: 'vector' was not declared in this scope
   16 | void answer(vector<int> s, vector<int> d){
      |                            ^~~~~~
cave.cpp:16:28: note: suggested alternatives:
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from cave.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note:   'std::vector'
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from cave.cpp:1:
/usr/include/c++/9/vector:90:13: note:   'std::pmr::vector'
   90 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
cave.cpp:16:35: error: expected primary-expression before 'int'
   16 | void answer(vector<int> s, vector<int> d){
      |                                   ^~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:21:5: error: 'vector' was not declared in this scope
   21 |     vector<int> cur(n,0), done(n,0), ans(n,0), ans2(n, 0);
      |     ^~~~~~
cave.cpp:21:5: note: suggested alternatives:
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from cave.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note:   'std::vector'
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from cave.cpp:1:
/usr/include/c++/9/vector:90:13: note:   'std::pmr::vector'
   90 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
cave.cpp:21:12: error: expected primary-expression before 'int'
   21 |     vector<int> cur(n,0), done(n,0), ans(n,0), ans2(n, 0);
      |            ^~~
cave.cpp:23:16: error: expected primary-expression before 'int'
   23 |         vector<int> mirror = cur;
      |                ^~~
cave.cpp:24:27: error: 'mirror' was not declared in this scope; did you mean 'perror'?
   24 |         if(tryCombination(mirror) == i){
      |                           ^~~~~~
      |                           perror
cave.cpp:24:12: error: 'tryCombination' was not declared in this scope
   24 |         if(tryCombination(mirror) == i){
      |            ^~~~~~~~~~~~~~
cave.cpp:26:21: error: 'done' was not declared in this scope
   26 |                 if(!done[j])
      |                     ^~~~
cave.cpp:27:21: error: 'cur' was not declared in this scope
   27 |                     cur[j] ^=1;
      |                     ^~~
cave.cpp:30:9: error: 'mirror' was not declared in this scope; did you mean 'perror'?
   30 |         mirror = cur;
      |         ^~~~~~
      |         perror
cave.cpp:30:18: error: 'cur' was not declared in this scope
   30 |         mirror = cur;
      |                  ^~~
cave.cpp:35:21: error: 'done' was not declared in this scope
   35 |                 if(!done[j])
      |                     ^~~~
cave.cpp:39:21: error: 'tryCombination' was not declared in this scope
   39 |             int x = tryCombination(mirror);
      |                     ^~~~~~~~~~~~~~
cave.cpp:62:9: error: 'done' was not declared in this scope
   62 |         done[lo] = 1;
      |         ^~~~
cave.cpp:63:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   63 |         ans[lo] = i;
      |         ^~~
      |         abs
cave.cpp:64:9: error: 'ans2' was not declared in this scope
   64 |         ans2[lo] = cur[lo];
      |         ^~~~
cave.cpp:70:12: error: 'ans2' was not declared in this scope
   70 |     answer(ans2, ans);
      |            ^~~~
cave.cpp:70:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
   70 |     answer(ans2, ans);
      |                  ^~~
      |                  abs
cave.cpp:70:5: error: 'answer' was not declared in this scope
   70 |     answer(ans2, ans);
      |     ^~~~~~