Submission #1222602

#TimeUsernameProblemLanguageResultExecution timeMemory
1222602walizamaneeUnscrambling a Messy Bug (IOI16_messy)C++20
100 / 100
1 ms584 KiB
#include<bits/stdc++.h> #include <vector> #include "messy.h" using namespace std; /* siz jokhon 1 hoi shurute full arrays jonno initializatiobn of function */ vector<int> ans , ek , dui , uttor; void makeans( vector<int> me , vector<int> him , int num ) { if( (int)me.size() > 1 ) { string shuru = "0"; string s = "0"; for( int z = 1; z < num; z++ ) { s += shuru; } for( int z = 0; z < (int)him.size(); z++ ) { s[him[z]] = '1'; } vector<int> one; vector<int> two; one.clear(); two.clear(); for( int z = 0; z < (int)me.size(); z++ ) { if( z < ((int)me.size() / 2) ) { one.push_back(me[z]); s[me[z]] = '1'; add_element(s); s[me[z]] = '0'; } else two.push_back(me[z]); } makeans( one , two , num ); makeans( two , one , num ); } } void getans( vector<int> me , vector<int> him , int num ) { if( (int)me.size() > 1 ) { string shuru = "0"; string s = "0"; for( int z = 1; z < num; z++ ) { s += shuru; } for( int z = 0; z < (int)him.size(); z++ ) { s[him[z]] = '1'; } vector<int> one; vector<int> two; one.clear(); two.clear(); for( int z = 0; z < (int)me.size(); z++ ) { s[me[z]] = '1'; bool lol = check_element(s); if( lol == 1 ) one.push_back(me[z]); else two.push_back(me[z]); s[me[z]] = '0'; } getans( one , two , num ); getans( two , one , num ); } else ans.push_back(me[0]); } vector<int> restore_permutation(int n, int w, int r) { string shuru = "0"; string s = "0"; for( int z = 1; z < n; z++ ) { s += shuru; } // cerr << s << "\n"; ans.clear(); ek.clear(); dui.clear(); for( int z = 0; z < (n / 2); z++ ) { ek.push_back(z); dui.push_back((n / 2) + z); s[z] = '1'; add_element(s); s[z] = '0'; } makeans( ek , dui , n ); makeans( dui , ek , n ); compile_set(); ek.clear(); dui.clear(); for( int z = 0; z < n; z++ ) { s[z] = '1'; bool lol = check_element(s); if( lol == 1 ) { ek.push_back(z); } else dui.push_back(z); s[z] = '0'; } getans( ek , dui , n ); getans( dui , ek , n ); uttor.clear(); uttor.resize(n); // cerr << ans.size() << "lol" << "\n"; for( int z = 0; z < n; z++ ) { uttor[ans[z]] = z; //uttor[z] = ans[z]; } return uttor; }

Compilation message (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...