제출 #936952

#제출 시각아이디문제언어결과실행 시간메모리
936952MuntherCarrot콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; // int press(string s) string guess_sequence(int N){ srand(time(69)); string ans; int x = rand() % 4; if(x == 1){ ans = "A"; while((int)ans.size() < N - 1){ string f = ans + "B" + ans + "XB" + ans + "XX" + ans + "XY"; // cout << f << endl; int res = press(f); if(res == (int)ans.size()){ ans += "Y"; } else if(res == (int)ans.size() + 1){ ans += "B"; } else{ ans += "X"; } } if(press(ans + "X") == N) ans += "X"; else if(press(ans + "Y") == N) ans += "Y"; else ans += "B"; } else if(x == 2){ cout << "HERE" << endl; ans = "B"; while((int)ans.size() < N - 1){ string f = ans + "A" + ans + "XA" + ans + "XX" + ans + "XY"; int res = press(f); if(res == (int)ans.size()){ ans += "Y"; } else if(res == (int)ans.size() + 1){ ans += "A"; } else{ ans += "X"; } } // cout << ans << endl; if(press(ans + "X") == N) ans += "X"; else if(press(ans + "Y") == N) ans += "Y"; else ans += "A"; } else if(x == 3){ ans = "X"; while((int)ans.size() < N - 1){ string f = ans + "B" + ans + "AB" + ans + "AA" + ans + "AY"; int res = press(f); if(res == (int)ans.size()){ ans += "Y"; } else if(res == (int)ans.size() + 1){ ans += "B"; } else{ ans += "A"; } } if(press(ans + "A") == N) ans += "A"; else if(press(ans + "Y") == N) ans += "Y"; else ans += "B"; } else{ ans = "Y"; while((int)ans.size() < N - 1){ string f = ans + "B" + ans + "XB" + ans + "XX" + ans + "XA"; int res = press(f); if(res == (int)ans.size()){ ans += "A"; } else if(res == (int)ans.size() + 1){ ans += "B"; } else{ ans += "X"; } } if(press(ans + "X") == N) ans += "X"; else if(press(ans + "A") == N) ans += "A"; else ans += "B"; } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:16: error: invalid conversion from 'int' to 'time_t*' {aka 'long int*'} [-fpermissive]
    9 |     srand(time(69));
      |                ^~
      |                |
      |                int
In file included from /usr/include/c++/10/ctime:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:49,
                 from combo.cpp:1:
/usr/include/time.h:75:29: note:   initializing argument 1 of 'time_t time(time_t*)'
   75 | extern time_t time (time_t *__timer) __THROW;
      |                     ~~~~~~~~^~~~~~~