結果
問題 | No.1544 [Cherry 2nd Tune C] Synchroscope |
ユーザー |
![]() |
提出日時 | 2021-06-11 21:32:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 439 ms / 2,000 ms |
コード長 | 1,508 bytes |
コンパイル時間 | 1,616 ms |
コンパイル使用メモリ | 194,388 KB |
最終ジャッジ日時 | 2025-01-22 05:34:47 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 48 |
コンパイルメッセージ
main.cpp: In function ‘void RI(i64&)’: main.cpp:15:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | inline void RI(i64 &i) {scanf("%lld", &(i));} | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long i64;typedef unsigned long long ui64;typedef vector<i64> vi;typedef vector<vi> vvi;typedef pair<i64, i64> pi;#define pb push_back#define sz(a) i64((a).size())#define all(c) (c).begin(), (c).end()#define REP(s, e, i) for(i=(s); i < (e); ++i)inline void RI(i64 &i) {scanf("%lld", &(i));}inline void RVI(vi &v) { for(i64 i=0;i<sz(v);++i) { RI(v[i]); } }inline void RVVI(vvi &vv) { for(i64 i=0;i<sz(vv);++i) { RVI(vv[i]); } }inline void WI(const i64 &i) {printf("%lld\n", i);}inline void WVI(const vi &v, char sep=' ') { for(i64 i=0;i<sz(v);++i) { if(i != 0){ printf("%c", sep); } printf("%lld", v[i]);} printf("\n"); }inline void WS(const string &s) { printf("%s\n", s.c_str()); }inline void WB(bool b, const string &yes, const string &no) { if(b){ WS(yes);} else { WS(no);} }inline void YESNO(bool b) { WB(b, "YES", "NO"); }inline void YesNo(bool b) { WB(b, "Yes", "No"); }#define BUF_LENGTH 1000000inline void RS(string &s) {static char buf[BUF_LENGTH]; scanf("%s", buf); s = buf;}template<typename T> inline bool IN(T &S, const typename T::key_type &key) {return S.find(key) != S.end();}template<typename T> inline bool ON(const T &b, i64 idx) {return ((T(1) << idx) & b) != 0;}int main(int argc, char *argv[]) {i64 i, j, k;i64 N, M; cin >> N >> M;vi A(N), B(M); RVI(A); RVI(B);i = 0;REP(0, N*M, i) {if(A[i%N] == B[i%M]) {WI(i+1);return 0;}}WI(-1);return 0;}