제출 #312491

#제출 시각아이디문제언어결과실행 시간메모리
312491mohamedsobhi777Mouse (info1cup19_mouse)C++14
컴파일 에러
0 ms0 KiB
#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 ; }

컴파일 시 표준 에러 (stderr) 메시지

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