# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
524215 | Lobo | Unscrambling a Messy Bug (IOI16_messy) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "messy.h"
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
// #define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define maxn
vector<int> restore_permutation(int n, int w, int r) {
vector<int> v;
for(int i = 0; i < n; i++) {
v.pb(mp(rand()%150,i));
}
sort(all(v));
vector<int> p1(n,0);
for(int i = 1; i <= n; i++) {
string s;
for(int j = 0; j < i; j++) s.pb('1');
for(int j = 0; j < n-i; j++) s.pb('0');
add_element(s);
}
compile_set();
string cur(n,'0');
for(int i = 0; i < n; i++) {
//encontrar qual j tem p[j] = i
for(auto X : v) {
int j = X.sc;
if(cur[j] == '1') continue;
cur[j] = '1';
bool ok;
// cout << cur << " " << ok ? "false" : "true" << endl;
ok = check_element(cur);
// cout << cur << " " << ok ? "false" : "true" << endl;
if(ok) {
p1[j] = i;
break;
}
cur[j] = '0';
}
}
return p1;
}