제출 #1233686

#제출 시각아이디문제언어결과실행 시간메모리
1233686lioowFinding Routers (IOI20_routers)C++20
컴파일 에러
0 ms0 KiB
#include "routers.h"
##include <bits/stdc++.h>
using namespace std;

std::vector<int> find_routers(int le, int n, int q) {
    int ans[n],lol[n];
    ans[0]=0;
    vector<int>memo(le+2,-1);
    for(int i=1;i<=n-1;i++){
    	int l=0;
    	int r=le;
    	int an=-1;
    	int lol=-1;
    	while(l<=r){
    		int mid=(l+r)/2;
    		int nw;
    		if(memo[mid]==-1){
    			nw=use_detector(mid);
    			memo[mid]=nw;
			} else nw=memo[mid];
    		if(nw>i-1) r=mid-1;
    		else {
    			an=mid;
    			l=mid+1;
			}
		}
		ans[i]=an*2-ans[i-1];
	}
	return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

routers.cpp:2:1: error: stray '##' in program
    2 | ##include <bits/stdc++.h>
      | ^~
routers.cpp:2:12: error: 'bits' was not declared in this scope
    2 | ##include <bits/stdc++.h>
      |            ^~~~
routers.cpp:2:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
    2 | ##include <bits/stdc++.h>
      |                 ^~~~
      |                 std
routers.cpp:2:12: error: 'bits' was not declared in this scope
    2 | ##include <bits/stdc++.h>
      |            ^~~~
routers.cpp:2:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
    2 | ##include <bits/stdc++.h>
      |                 ^~~~
      |                 std
routers.cpp:2:12: error: 'bits' was not declared in this scope
    2 | ##include <bits/stdc++.h>
      |            ^~~~
routers.cpp:2:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
    2 | ##include <bits/stdc++.h>
      |                 ^~~~
      |                 std
routers.cpp:2:12: error: 'bits' was not declared in this scope
    2 | ##include <bits/stdc++.h>
      |            ^~~~
routers.cpp:2:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
    2 | ##include <bits/stdc++.h>
      |                 ^~~~
      |                 std
routers.cpp:2:12: error: 'bits' was not declared in this scope
    2 | ##include <bits/stdc++.h>
      |            ^~~~
routers.cpp:2:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
    2 | ##include <bits/stdc++.h>
      |                 ^~~~
      |                 std
routers.cpp:2:12: error: 'bits' was not declared in this scope
    2 | ##include <bits/stdc++.h>
      |            ^~~~
routers.cpp:2:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
    2 | ##include <bits/stdc++.h>
      |                 ^~~~
      |                 std
routers.cpp:2:12: error: 'bits' was not declared in this scope
    2 | ##include <bits/stdc++.h>
      |            ^~~~
routers.cpp:2:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
    2 | ##include <bits/stdc++.h>
      |                 ^~~~
      |                 std
routers.cpp:2:12: error: 'bits' was not declared in this scope
    2 | ##include <bits/stdc++.h>
      |            ^~~~
routers.cpp:2:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
    2 | ##include <bits/stdc++.h>
      |                 ^~~~
      |                 std
routers.cpp:2:12: error: 'bits' was not declared in this scope
    2 | ##include <bits/stdc++.h>
      |            ^~~~
routers.cpp:2:17: error: 'stdc' was not declared in this scope; did you mean 'std'?
    2 | ##include <bits/stdc++.h>
      |                 ^~~~
      |                 std
routers.cpp:2:3: error: 'include' does not name a type
    2 | ##include <bits/stdc++.h>
      |   ^~~~~~~
routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int>memo(le+2,-1);
      |     ^~~~~~
routers.cpp:8:5: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from routers.h:1,
                 from routers.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from routers.h:1,
                 from routers.cpp:1:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
routers.cpp:8:12: error: expected primary-expression before 'int'
    8 |     vector<int>memo(le+2,-1);
      |            ^~~
routers.cpp:17:20: error: 'memo' was not declared in this scope
   17 |                 if(memo[mid]==-1){
      |                    ^~~~
routers.cpp:29:16: error: could not convert 'ans' from 'int [n]' to 'std::vector<int>'
   29 |         return ans;
      |                ^~~
      |                |
      |                int [n]