제출 #1153371

#제출 시각아이디문제언어결과실행 시간메모리
1153371zhasynUnscrambling a Messy Bug (IOI16_messy)C++20
38 / 100
0 ms332 KiB
#include "messy.h"
#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
using namespace std;
#define F first
#define S second
typedef long long ll;
#define pii pair <int, int>
#define pll pair <ll, ll>
typedef long double ld;
const ll N = 2 * 1e5 + 100, M = 1e7 + 10, len = 21, inf = 1e18;
const ll mod = 998244353;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll um(ll a, ll b){
	return (1LL * a * b) % mod;
}
ll subr(ll a, ll b){
	return ((1LL * a - b) % mod + mod) % mod;
}
bool was[N];
int pos[N];
// void add_element(string s){
	// cout << s << endl;
// }
// bool check_element(string s){
	// cout << s << endl;
	// bool x;
	// cin >> x;
	// return x;
// }
vector<int> restore_permutation(int n, int w, int r) {
	string s = "", t = "";
	vector <int> vec;
	for(int i = 0; i < n; i++){
		s += '0';
		t += '0';
	}
	for(int i = 0; i < n; i++){
		s[i] = '1';
		add_element(s);
	}
	//cout << endl;
    compile_set();
    bool res;
    for(int i = 0; i < n; i++){
    	for(int j = 0; j < n; j++){
    		if(was[j]) continue;
    		t[j] = '1';
    		res = check_element(t);
    		if(res){
    			was[j] = true;
    			pos[j] = i;
    			break;
    		} 
    		t[j] = '0';
    	}
    }
    for(int i = 0; i < n; i++){
    	vec.pb(pos[i]);
    }
    return vec;
}

// int main() {
//   ios::sync_with_stdio(false);
//   cin.tie(NULL);
//   int n, w, r;
//   cin >> n >> w >> r;
//   vector <int> vec = restore_permutation(n, w, r);
//   for(auto u : vec){
//   	cout << u << " ";
//   }
//   return 0;
// }

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

messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...