제출 #1071415

#제출 시각아이디문제언어결과실행 시간메모리
1071415mc061Unscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
1 ms440 KiB
#pragma once #include <bits/stdc++.h> using namespace std; void add_element(std::string x); bool check_element(std::string x); void compile_set(); std::vector<int> restore_permutation(int n, int w, int r) { string s(n, '0'); for (int i = 0; i < n-1; ++i) { s[i] = '1'; add_element(s); } compile_set(); vector<pair<int, int>> know; vector<bool> busy(n, false); for (int bits = 1; bits < n; ++bits) { string cur(n, '0'); for (auto [was, now] : know) { cur[now] = '1'; } vector<string> pot; for (int i = 0; i < n; ++i) { if (cur[i] == '1') continue; cur[i] = '1'; pot.push_back(cur); cur[i] = '0'; } random_shuffle(pot.begin(), pot.end()); for (int i = 0; i < pot.size(); ++i) { // cerr << "ck "; // for (char c : pot[i]) cerr << c; // cerr << " : "; bool x = check_element(pot[i]); // cerr << x << endl; if (!x) continue; for (int j = 0; j < n; ++j) { if (pot[i][j] != '1' || busy[j]) continue; busy[j] = true; know.push_back({bits-1, j}); } break; } } vector<int> perm(n, -1); for (auto [was, now] : know) { perm[now] = was; } for (int i = 0; i < n; ++i) { if (perm[i] == -1) perm[i] = n-1; } // cerr << endl; return perm; }

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

messy.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:22:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   22 |         for (auto [was, now] : know) {
      |                   ^
messy.cpp:34:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for (int i = 0; i < pot.size(); ++i) {
      |                         ~~^~~~~~~~~~~~
messy.cpp:50:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   50 |     for (auto [was, now] : know) {
      |               ^
#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...