This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <vector>
#include "messy.h"
// abreviaciones de datos y funciones de ellas
#define ll long long
#define st string
#define p pair
#define f first
#define s second
#define v vector
#define pb push_back
#define vi v<int>
#define vll vector <long long>
#define vst vector<string>
#define vpll vector <pair<ll,ll>>
#define vvll v<vll>
#define as assign
#define pll pair<ll,ll>
#define matrizll v<vll>
#define matrizch v<v<char>>
#define itrll vll::iterator
#define itrst vst::iterator
#define itrpll vpll::iterator
#define all(x) x.begin(),x.end()
#define pq priority_queue
#define pq_ll pq <ll>
#define pq_st pq <st>
#define pq_pll pq<pll>
// abreviaciones funciones de impresion
#define espa ' '
#define en '\n'
#define coutv(a) for(auto x:a){cout<<x<<en;}
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
//funciones comunes
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repm(i,a) for(ll i=a;i>0;i--)
#define test(t) while(t--)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end());
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
st a;
rep(i,0,n){
a.pb('0');
}
repm(i,n-1){
a[i]='1';
add_element(a);
//cout<<a<<en;
}
vi orden(n,0);
v<bool> ya(n,false);
compile_set();
//cout<<en;
rep(i,1,n){
a[i]='0';
}
bool es=false;
repm(j,n-1){
rep(i,0,n){
if(ya[i]==true) continue;
a[i]='1';
/*
cout<<i<<espa<<j<<en;
cout<<a<<en;
*/
if(check_element(a)==true){
orden[j]=i;
ya[i]=true;
es=true;
}
if(es==true){es=false;break;}
a[i]='0';
}
//cout<<en;
}
rep(i,0,n){
if(ya[i]==false){orden[0]=i;break;}
}
return orden;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |