結果
| 問題 |
No.382 シャイな人たち (2)
|
| コンテスト | |
| ユーザー |
sigma425
|
| 提出日時 | 2017-09-15 02:01:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,684 bytes |
| コンパイル時間 | 1,748 ms |
| コンパイル使用メモリ | 164,596 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 21:26:43 |
| 合計ジャッジ時間 | 47,712 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 1 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
struct Timer{
clock_t st;
void start(){
st = clock();
}
int ms(){
return (clock()-st)*1000 / CLOCKS_PER_SEC;
}
};
typedef long long ll;
ll S;
int next(){
S = S*12345%1000003;
return S;
}
int N,P;
bitset<128> E[128];
unsigned long long seed = 1145141919810893ULL;
int xor_rand(){
seed = seed ^ (seed<<13);
seed = seed ^ (seed>>7);
seed = seed ^ (seed<<17);
return (seed>>33);
}
int main(){
Timer timer;
timer.start();
cin>>S;
N = next()%120 + 2;
P = next();
rep(i,N) for(int j=i+1;j<N;j++) if(next()>=P) E[i].set(j),E[j].set(i); //1:cannot
vector<int> p(N);
rep(i,N) p[i] = i;
vector<int> ans;
int prevt = timer.ms();
while(true){
int t = timer.ms();
if(t + (t-prevt) >= 2000) break;
prevt = t;
rep(tt,5000){
bitset<128> B;
vector<int> tmp;
rep(j,N) swap(p[j],p[xor_rand()%(j+1)]);
rep(j,N) if(!B[p[j]]){
tmp.pb(p[j]);
B |= E[p[j]];
}
if(tmp.size()>ans.size()) ans = tmp;
}
}
if(ans.size()==N){
puts("-1");
return 0;
}
int K = ans.size();
cout<<K+1<<endl;
rep(i,K) cout<<ans[i]+1<<(i==K-1?"\n":" ");
}
sigma425