제출 #298336

#제출 시각아이디문제언어결과실행 시간메모리
298336HideoUnscrambling a Messy Bug (IOI16_messy)C++11
70 / 100
4 ms384 KiB
#include "messy.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; #define ll long long #define mk make_pair #define fr first #define sc second #define pb push_back #define vi vector < int > #define pi pair < int, int > const int N = 256; int x[N], us[N], go[N], rv[N], sz; vi ans; vi restore_permutation(int n, int w, int r){ srand(time(NULL)); if (n == 128) sz = 11; else sz = 4; for (int i = 1; i <= n; i++) x[i] = i; random_shuffle(x + 1, x + n + 1); for (int i = 1; i <= n; i++) rv[x[i]] = i; int cc = 0; for (int i = 1; i <= n; i++){ if (i > (cc + 1) * sz) cc++; string s = ""; for (int j = 1; j <= n; j++){ if (x[j] <= cc * sz || x[j] == i) s += '1'; else s += '0'; } add_element(s); } for (int j = 1; j <= n; j++){ string s = ""; if (j % sz == 1){ for (int i = 1; i <= n; i++){ if (x[i] <= j) s += '0'; else s += '1'; } } else { for (int i = 1; i <= n; i++){ if (x[i] <= j) s += '1'; else s += '0'; } } add_element(s); } compile_set(); set < int > st; for (int i = 1; i <= n; i++) st.insert(i); for (int i = 1; i <= n; i += sz){ int r = min(i + sz - 1, n); set < int > cur; for (int it : st){ if (cur.size() == sz) break; string s = ""; for (int m = 1; m <= n; m++){ if (us[m] || m == it) s += '1'; else s += '0'; } if (check_element(s)) cur.insert(it); } for (int it : cur) st.erase(it); for (int j = i; j < r; j++){ int f = 0; for (int it : cur){ if (it == *cur.rbegin()){ f = it; break; } string s = ""; for (int m = 1; m <= n; m++){ if ((j == i && (us[m] || m == it)) || (j != i && !us[m] && m != it)) s += '0'; else s += '1'; } if (check_element(s)){ f = it; break; } } cur.erase(f); us[f] = rv[j]; } us[*cur.begin()] = rv[r]; cur.erase(*cur.begin()); } for (int i = 1; i <= n; i++) ans.pb(us[i] - 1); return ans; }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:72:28: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   72 |             if (cur.size() == sz)
      |                 ~~~~~~~~~~~^~~~~
#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...