제출 #731635

#제출 시각아이디문제언어결과실행 시간메모리
731635vjudge1Unscrambling a Messy Bug (IOI16_messy)C++11
100 / 100
3 ms468 KiB
#include "messy.h" #include <bits/stdc++.h> #include <vector> using namespace std; std::vector<int> restore_permutation(int n, int w, int r) { function<void(int, int)> prep = [&](int l, int r) { // [l, r) if (l + 1 == r) return; string base(n, '0'); for (int i = 0; i < l; i++) base[i] = '1'; for (int i = r; i < n; i++) base[i] = '1'; int m = l + r >> 1; for (int i = l; i < m; i++) { string tmp = base; tmp[i] = '1'; add_element(tmp); } prep(l, m); prep(m, r); }; vector<int> ans(n); function<void(int, int, vector<int>)> guess = [&](int l, int r, vector<int> candidates) { // [l, r) if (l + 1 == r) return void(ans[candidates[0]] = l); string base(n, '1'); for (int i : candidates) base[i] = '0'; vector<int> cl, cr; for (int i : candidates) { string tmp = base; tmp[i] = '1'; vector<int>& which = check_element(tmp) ? cl : cr; which.emplace_back(i); } int m = l + r >> 1; guess(l, m, cl); guess(m, r, cr); }; prep(0, n); compile_set(); vector<int> id(n); iota(id.begin(), id.end(), 0); guess(0, n, id); return ans; }

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

messy.cpp: In lambda function:
messy.cpp:15:27: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   15 |                 int m = l + r >> 1;
      |                         ~~^~~
messy.cpp: In lambda function:
messy.cpp:37:27: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   37 |                 int m = l + r >> 1;
      |                         ~~^~~
#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...