Submission #312493

# Submission time Handle Problem Language Result Execution time Memory
312493 2020-10-13T14:23:07 Z mohamedsobhi777 Mouse (info1cup19_mouse) C++14
0 / 100
1 ms 256 KB
#include "grader.h"
#include<bits/stdc++.h>
using namespace std ; 
int n, num ;
vector<int> per, ans ; 

void solve(int n){ 

        for(int i = 1;i <= n ; ++ i){
                ans.push_back(i) ; 
        }

        for(int i = 0 ;i < n; ++ i){
                int x ; cin >> x ;
                per.push_back(x) ; 
        }

        random_shuffle(ans.begin() , ans.end()) ; 
        srand(time(0)) ; 
        int tim = 0 ; 
        int las = 0 ; 
        while(tim ++ < 1000000){
                int x = rand() % n ; 
                int y = rand() % n; 
                if(x == y)continue ; 
                swap(ans[x],ans[y]) ; 
                int now = query(ans) ; 
                if(now < las)swap(ans[x],ans[y]) ;
                las = max(las , now) ; 
                if(now == n)
                        return ;
        }
        return ; 
        if(las == n)
                cout<<"ok " << num ; 
        else 
                cout<<"incorrect" ; 
        return ; 
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 256 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 256 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 256 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -