結果

問題 No.2828 Remainder Game
ユーザー 4094706840947068
提出日時 2024-08-02 23:01:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 2,357 bytes
コンパイル時間 1,443 ms
コンパイル使用メモリ 121,512 KB
実行使用メモリ 25,208 KB
平均クエリ数 60.00
最終ジャッジ日時 2024-08-02 23:01:44
合計ジャッジ時間 3,878 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
25,184 KB
testcase_01 AC 59 ms
24,940 KB
testcase_02 AC 65 ms
24,812 KB
testcase_03 AC 63 ms
24,940 KB
testcase_04 AC 61 ms
25,196 KB
testcase_05 AC 63 ms
24,824 KB
testcase_06 AC 58 ms
24,824 KB
testcase_07 AC 61 ms
24,824 KB
testcase_08 AC 60 ms
24,952 KB
testcase_09 AC 61 ms
25,208 KB
testcase_10 AC 62 ms
24,952 KB
testcase_11 AC 62 ms
24,952 KB
testcase_12 AC 61 ms
24,952 KB
testcase_13 AC 64 ms
24,568 KB
testcase_14 AC 67 ms
24,952 KB
testcase_15 AC 67 ms
25,208 KB
testcase_16 AC 67 ms
24,952 KB
testcase_17 AC 65 ms
25,208 KB
testcase_18 AC 66 ms
24,952 KB
testcase_19 AC 66 ms
24,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
        }
    }
}
0