Submission #312495

# Submission time Handle Problem Language Result Execution time Memory
312495 2020-10-13T14:31:34 Z mohamedsobhi777 Mouse (info1cup19_mouse) C++14
19.2529 / 100
3000 ms 256 KB
#include "grader.h"
#include<bits/stdc++.h>
using namespace std ; 
int n, num ;
vector<int> per, ans ; 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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() ) ; 
        int tim = 0 ; 
        int las = 0 ; 
        while(tim ++ < 1000000){
                int x = rng() % n ; 
                int y = rng() % 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 Correct 1 ms 256 KB Correct! Number of queries: 43
2 Correct 0 ms 256 KB Correct! Number of queries: 8
3 Correct 1 ms 256 KB Correct! Number of queries: 53
4 Correct 1 ms 256 KB Correct! Number of queries: 38
5 Correct 1 ms 256 KB Correct! Number of queries: 24
6 Correct 1 ms 256 KB Correct! Number of queries: 76
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Correct! Number of queries: 43
2 Correct 0 ms 256 KB Correct! Number of queries: 8
3 Correct 1 ms 256 KB Correct! Number of queries: 53
4 Correct 1 ms 256 KB Correct! Number of queries: 38
5 Correct 1 ms 256 KB Correct! Number of queries: 24
6 Correct 1 ms 256 KB Correct! Number of queries: 76
7 Correct 47 ms 256 KB Correct! Number of queries: 3400
8 Correct 55 ms 256 KB Correct! Number of queries: 3700
9 Correct 56 ms 256 KB Correct! Number of queries: 3700
10 Correct 77 ms 256 KB Correct! Number of queries: 6600
11 Correct 44 ms 256 KB Correct! Number of queries: 3000
12 Correct 37 ms 256 KB Correct! Number of queries: 2700
13 Correct 38 ms 256 KB Correct! Number of queries: 3100
14 Correct 103 ms 256 KB Correct! Number of queries: 6800
15 Correct 102 ms 256 KB Correct! Number of queries: 6800
16 Correct 64 ms 256 KB Correct! Number of queries: 4600
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Correct! Number of queries: 43
2 Correct 0 ms 256 KB Correct! Number of queries: 8
3 Correct 1 ms 256 KB Correct! Number of queries: 53
4 Correct 1 ms 256 KB Correct! Number of queries: 38
5 Correct 1 ms 256 KB Correct! Number of queries: 24
6 Correct 1 ms 256 KB Correct! Number of queries: 76
7 Correct 47 ms 256 KB Correct! Number of queries: 3400
8 Correct 55 ms 256 KB Correct! Number of queries: 3700
9 Correct 56 ms 256 KB Correct! Number of queries: 3700
10 Correct 77 ms 256 KB Correct! Number of queries: 6600
11 Correct 44 ms 256 KB Correct! Number of queries: 3000
12 Correct 37 ms 256 KB Correct! Number of queries: 2700
13 Correct 38 ms 256 KB Correct! Number of queries: 3100
14 Correct 103 ms 256 KB Correct! Number of queries: 6800
15 Correct 102 ms 256 KB Correct! Number of queries: 6800
16 Correct 64 ms 256 KB Correct! Number of queries: 4600
17 Execution timed out 3008 ms 256 KB Time limit exceeded
18 Halted 0 ms 0 KB -