結果
| 問題 |
No.382 シャイな人たち (2)
|
| コンテスト | |
| ユーザー |
kmjp
|
| 提出日時 | 2016-08-06 01:16:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,742 bytes |
| コンパイル時間 | 1,709 ms |
| コンパイル使用メモリ | 167,296 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-07 01:44:25 |
| 合計ジャッジ時間 | 91,099 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:65:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
65 | _P("%d\n",R.size()+1);
| ^~~~~~ ~~~~~~~~~~
| |
| std::vector<int>::size_type {aka long unsigned int}
main.cpp:7:30: note: in definition of macro ‘_P’
7 | #define _P(...) (void)printf(__VA_ARGS__)
| ^~~~~~~~~~~
main.cpp:65:14: note: format string is defined here
65 | _P("%d\n",R.size()+1);
| ~^
| |
| int
| %ld
ソースコード
#include <bits/stdc++.h>
#include <sys/time.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
ll S;
int N,P;
vector<int> E[130];
int A[200];
static unsigned long long seed = 88172645463325252ULL;
int xor_rand() {
seed ^= (seed << 13);
seed ^= (seed >> 7);
seed ^= (seed << 17);
return seed & 0xFFFFFF;
}
ll nex(){ return S=(S*12345)%1000003;}
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>S;
N=nex()%120+2;
P=nex();
FOR(i,N) for(j=i+1;j<N;j++) if(nex()>=P) E[i].push_back(j), E[j].push_back(i);
FOR(i,N) A[i]=i;
struct timeval tv1,tv2;
gettimeofday(&tv1,NULL);
vector<int> R;
R.push_back(0);
y=0;
while(1) {
gettimeofday(&tv2,NULL);
if((tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec)>4000000) break;
seed = tv2.tv_usec;
FOR(i,5000) {
y++;
bitset<128> B;
vector<int> T;
FOR(j,N-1) swap(A[j],A[j+xor_rand() % (N-j)]);
FOR(j,N) if(B.test(A[j])==0) {
T.push_back(A[j]+1);
FORR(e,E[A[j]]) B.set(e);
}
if(R.size()<T.size()) {
R=T;
}
}
}
if(R.size()==N) return _P("-1\n");
_P("%d\n",R.size()+1);
sort(ALL(R));
FOR(i,R.size()) _P("%d%c",R[i],(i==R.size()-1)?'\n':' ');
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n';
FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
solve(); return 0;
}
kmjp