제출 #229828

#제출 시각아이디문제언어결과실행 시간메모리
229828achibasadzishviliUnscrambling a Messy Bug (IOI16_messy)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll int #define f first #define s second #define pb push_back using namespace std; #include "messy.h" vector<int> restore_permutation(int n, int w, int r){ srand(time(123123123)); string s = ""; for(int i=1; i<=n; i++) s += '0'; for(int i=0; i<n; i++){ s[i] = '1'; add_element(s); } compile_set(); string a = ""; for(int i=0; i<n; i++) a += '0'; vector<ll>p; for(int i=0; i<n; i++) p.pb(0); for(int i=0; i<n; i++){ vector<ll>k; for(int j=0; j<n; j++) if(a[j] == '0') k.pb(j); random_shuffle(k.begin() , k.end()); random_shuffle(k.begin() , k.end()); random_shuffle(k.begin() , k.end()); random_shuffle(k.begin() , k.end()); random_shuffle(k.begin() , k.end()); for(int ji=0; ji<n; ji++){ int j = k[ji]; if(a[j] == '0'){ a[j] = '1'; if(check_element(a)){ //cout << i << " <-> " << j << '\n'; p[j] = i; break; } a[j] = '0'; } } } return p; }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:10:25: error: invalid conversion from 'int' to 'time_t* {aka long int*}' [-fpermissive]
     srand(time(123123123));
                         ^
In file included from /usr/include/c++/7/ctime:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:49,
                 from messy.cpp:1:
/usr/include/time.h:192:15: note:   initializing argument 1 of 'time_t time(time_t*)'
 extern time_t time (time_t *__timer) __THROW;
               ^~~~