結果
問題 | No.2828 Remainder Game |
ユーザー |
|
提出日時 | 2024-08-02 23:01:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 78 ms / 2,000 ms |
コード長 | 2,357 bytes |
コンパイル時間 | 1,299 ms |
コンパイル使用メモリ | 118,436 KB |
最終ジャッジ日時 | 2025-02-23 20:20:35 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include<iostream> #include<sstream> #include<algorithm> #include<deque> #include<list> #include<map> #include<memory> #include<queue> #include<set> #include<stack> #include<utility> #include<string.h> #include<string> #include<math.h> #include<float.h> #include<stdio.h> #include<vector> #include<iomanip> #include<bitset> //#include<random> using namespace std; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<typename T> inline bool chmin(T &a, T b) { return ((a>b) ? (a = b, true) : (false));} #define rep(i,s,n) for(long long i=s;i<(long long)(n);i++) #define rrep(i,s,n) for(long long i=n-1;i>=s;i--) const long long inf = 1LL<<60; typedef long long ll; typedef long double ld; #define cmp [](pair<ll,ll> a, pair<ll,ll> b){return a.second<b.second;} //pairのsecondでソートsort(p.begin(),p.end(),cmp) typedef pair<long long, long long> P; typedef pair<ll, pair<ll,ll> > PP; #define rll ll,vector<ll>,greater<ll> #define rP P,vector<P>,greater<P> const long double pi = 3.14159265358979; typedef unsigned long long ull; #define vll vector<ll> #define vvll vector<vector<ll>> #define vvch vector<vector<char>> #define vch vector<char> #define rPP PP,vector<PP>,greater<PP> #define vP vector<P> #define vvP vector<vector<P>> #define all(x) x.begin(), x.end() //bitの差集合 S & ~(1<<i) //UNIQUE(x) xをソートして値の被りがないようにする #define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end()) int main() { int n; cin >> n; vector<vector<ll>> vecs(12,vector<ll>(12,0)); int nums[]={8,3,5,7,11}; rep(i,0,5) { int cn = 0; rep(j,0,nums[i]-1) { cout << nums[i] << " " << 1 << endl; cout << j << endl; ll x; cin >> x; vecs[nums[i]][j] = x; cn += x; fflush(stdout); } vecs[nums[i]][nums[i]-1] = 5 - cn; } vector<P> mods(5); rep(i,0,5) { ll sum = 0; rep(j,0,nums[i]) sum += vecs[nums[i]][j] * j; sum %= nums[i]; mods[i] = make_pair(sum, nums[i]); } rep(i,1,5*n+1) { bool flag = true; rep(j,0,5) if(i % mods[j].second != mods[j].first) flag = false; if(flag) { cout << 0 << " " << 1 << endl; cout << i << endl; return 0; } } }