Submission #312491

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

int main(){
        ios_base::sync_with_stdio(0) ;
        cin.tie(0) ; 
        freopen("in.in" , "r" , stdin) ; 
        cin >> 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)
                        break ;
        }
        return 0 ; 
        if(las == n)
                cout<<"ok " << num ; 
        else 
                cout<<"incorrect" ; 
        return 0 ; 
}

Compilation message

mouse.cpp: In function 'int main()':
mouse.cpp:10:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   10 |         freopen("in.in" , "r" , stdin) ;
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccWomGbe.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccay27Ps.o:mouse.cpp:(.text.startup+0x0): first defined here
/tmp/ccWomGbe.o: In function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status