Submission #132316

#TimeUsernameProblemLanguageResultExecution timeMemory
132316claudyUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
4 ms508 KiB
#include "messy.h" //# pragma GCC optimize("Ofast,no-stack-protector") //# pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") # pragma GCC optimize("Ofast") # pragma GCC optimization ("unroll-loops") # include "bits/stdc++.h" /* # include <ext/pb_ds/tree_policy.hpp> # include <ext/pb_ds/assoc_container.hpp> # include <ext/rope> */ std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}}; # define ll long long # define clock (clock() * 1000.0 / CLOCKS_PER_SEC) # define rc(s) return cout << s,0 # define rcg(s) cout << s;exit(0) # define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0); # define db(x) cerr << #x << " = " << x << '\n' # define pb push_back # define mp make_pair # define all(s) s.begin(),s.end() # define sz(x) (int)((x).size()) using namespace std; int n; void rec1(int a,int b) { if(a == b) return; string s = ""; for(int i = 0;i < n;i++) s += '0'; for(int i = 0;i < n;i++) if(i < a || i > b) s[i] = '1'; int mid = (a + b) / 2; for(int i = a;i <= mid;i++) { s[i] = '1'; add_element(s); s[i] = '0'; } s.clear(); rec1(a,mid); rec1(mid + 1,b); } string str = ""; vector<int>ans; void rec2(int a,int b,vector<int>vec) { if(a == b) { ans[vec[0]] = a; return ; } vector<int>vecb; vector<int>veca; string s = ""; for(int i = 0;i < n;i++) s += "1"; for(auto it : vec) s[it] = '0'; for(auto it : vec) { s[it] = '1'; if(check_element(s)) veca.pb(it); else vecb.pb(it); s[it] = '0'; } int mid = (a + b) / 2; rec2(a,mid,veca); rec2(mid + 1,b,vecb); } vector<int> restore_permutation(int N, int w, int r) { n = N; ans.resize(n); rec1(0,n - 1); compile_set(); vector<int>vec; for(int i = 0;i < n;i++) vec.pb(i); rec2(0,n - 1,vec); return ans; }

Compilation message (stderr)

messy.cpp:6:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 # pragma GCC optimization ("unroll-loops")
#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...