제출 #1023207

#제출 시각아이디문제언어결과실행 시간메모리
1023207TroySerUnscrambling a Messy Bug (IOI16_messy)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; vector<int> restore_permutation(int n, int w, int r) { random_device rd; mt19937 g(rd()); string toAdd[n-1]; for (int i = 1; i <= n-1; i++) { string s = ""; for (int j = 0; j < i; j++) { s += "1"; } for (int j = i; j < n; j++) { s += "0"; } toAdd[i - 1] = s; } for (int i = 0; i < n-1; i++) { shuffle(toAdd[i].begin(), toAdd[i].end(), g); add_element(toAdd[i]); } compile_set(); vector<int> perm(n, -1); string currString, prevString = ""; for (int i = 0; i < n; i++) prevString.push_back('0'); for (int i = 0; i < n-1; i++) { currString = prevString; bool getOut = false; for (int j = 0; j < n; j++) { if (currString[j] == '0') { currString[j] = '1'; if (check_element(currString)) { perm[j] = i; break; } currString[j] = '0'; } } prevString = currString; } for (int i = 0; i < n; i++) { if (perm[i] == -1) { perm[i] = n-1; break; } } return perm; }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:37:14: warning: unused variable 'getOut' [-Wunused-variable]
   37 |         bool getOut = false;
      |              ^~~~~~
#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...