제출 #969517

#제출 시각아이디문제언어결과실행 시간메모리
969517anango동굴 (IOI13_cave)C++17
0 / 100
2 ms860 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; #define int long long int tryvec(vector<int> v) { int32_t attempt[v.size()]; for (int i=0; i<v.size(); i++) { attempt[i] = v[i]; } int T=tryCombination(attempt); if (T==-1) { return v.size(); } return T; } void ansvec(vector<int> v, vector<int> w) { int32_t attempt[v.size()]; int32_t perm[v.size()]; for (int i=0; i<v.size(); i++) { attempt[i] = v[i]; perm[i] = w[i]; } answer(attempt, perm); } void exploreCave(int32_t N) { int n=N; vector<int> permutation(n,-1); vector<int> answers(n,-1); vector<int> current(n,-1); for (int cur=0; cur<N; cur++) { //find if the intended state is off or on current=vector<int>(n,0); for (int i=0; i<n; i++) { if (answers[i]!=-1) { current[i] = answers[i]; } } int ans = tryvec(current); int ist=-1; if (ans==cur) { //intended state is 1 ist=1; int l=0; int r=N; while (l<r) { int m=(l+r)/2; for (int i=l; i<=m; i++) { if (answers[i]==-1) { current[i] = 1; } } if (tryvec(current)==cur) { l=m+1; r=r; } else { l=l; r=m; } } answers[l] = ist; permutation[cur] = l; } else { assert(ans==cur+1); //intended state is 0 current=vector<int>(n,1); for (int i=0; i<n; i++) { if (answers[i]!=-1) { current[i] = answers[i]; } } int l=0; int r=N; while (l<r) { int m=(l+r)/2; for (int i=l; i<=m; i++) { if (answers[i]==-1) { current[i] = 0; } } if (tryvec(current)==cur) { l=m+1; r=r; } else { l=l; r=m; } } ist=0; answers[l] = ist; permutation[cur] = l; } } ansvec(answers, permutation); }

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

cave.cpp: In function 'long long int tryvec(std::vector<long long int>)':
cave.cpp:8:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i=0; i<v.size(); i++) {
      |                   ~^~~~~~~~~
cave.cpp: In function 'void ansvec(std::vector<long long int>, std::vector<long long int>)':
cave.cpp:20:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int i=0; i<v.size(); i++) {
      |                   ~^~~~~~~~~
#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...