結果
| 問題 |
No.2828 Remainder Game
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2024-08-02 22:14:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 2,000 ms |
| コード長 | 996 bytes |
| コンパイル時間 | 4,162 ms |
| コンパイル使用メモリ | 251,240 KB |
| 最終ジャッジ日時 | 2025-02-23 20:05:24 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001
int n;
unsigned long xor128() {
static unsigned long x=123456789, y=362436069, z=521288629, w=88675123;
unsigned long t=(x^(x<<11));
x=y; y=z; z=w;
return (w=(w^(w>>19))^(t^(t>>8)));
}
int main(){
cin>>n;
vector<long long> p = {2,9,5,7,11};
vector<long long> s(5);
rep(i,5){
vector<int> r(p[i]);
rep(j,p[i]){
r[j] = j;
}
rep(_,100){
int a = xor128()%p[i];
int b = xor128()%p[i];
swap(r[a],r[b]);
}
int rem = 5;
int sum = 0;
rep(j,p[i]-1){
if(rem==0)break;
cout<<p[i]<<' '<<1<<endl;
cout<<r[j]<<endl;
int ret;
cin>>ret;
rem -= ret;
sum += r[j]*ret;
}
sum += r[p[i]-1]*rem;
s[i] = sum%p[i];
}
auto ans = crt(s,p);
cout<<0<<' '<<1<<endl;
cout<<ans.first<<endl;
return 0;
}
沙耶花