結果
| 問題 |
No.382 シャイな人たち (2)
|
| コンテスト | |
| ユーザー |
yosupot
|
| 提出日時 | 2016-06-18 00:24:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,450 bytes |
| コンパイル時間 | 1,114 ms |
| コンパイル使用メモリ | 107,384 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-09 19:58:48 |
| 合計ジャッジ時間 | 161,859 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 1 |
ソースコード
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int TEN(int n) {return (n==0)?1:10*TEN(n-1);}
ll nex(ll S) {
return (S * 12345) % 1000003;
}
const int MN = 130;
int N;
vector<int> g[MN];
int idx[MN];
namespace StopWatch {
clock_t st;
bool f = false;
void start() {
f = true;
st = clock();
}
int msecs() {
assert(f);
return (clock()-st)*1000 / CLOCKS_PER_SEC;
}
}
void solve() {
/* printf("N: %d\n", N);
for (int i = 0; i < N; i++) {
printf("vec %d:", i);
for (int d: g[i]) {
printf("%d ", d);
}
printf("\n");
}*/
int ans = 0;
vector<int> ans_p;
srand(time(NULL));
iota(idx, idx+N, 0);
StopWatch::start();
while (StopWatch::msecs() < 7200) {
for (int fe = 0; fe < 1000; fe++) {
random_shuffle(idx, idx+N);
bool used[N];
fill_n(used, N, false);
int co = 0;
vector<int> res;
for (int i = 0; i < N; i++) {
int p = idx[i];
if (!used[p]) {
res.push_back(p+1);
co++;
for (int d: g[p]) {
used[d] = true;
}
}
}
if (ans < co) {
ans = co;
ans_p = res;
// printf("ans ref %d\n", co);
}
}
}
if (ans == N) {
printf("-1\n");
return;
}
printf("%d\n", ans+1);
int m = (int)ans_p.size();
for (int i = 0; i < m; i++) {
printf("%d", ans_p[i]);
if (i < m-1) {
printf(" ");
} else {
printf("\n");
}
}
}
int main() {
ll S;
cin >> S;
S = nex(S);
N = (S % 120) + 2;
S = nex(S);
ll P = S;
for (int i = 0; i < N; i++) {
for (int j = i+1; j < N; j++) {
S = nex(S);
if (S >= P) {
g[i].push_back(j);
g[j].push_back(i);
}
}
}
solve();
return 0;
}
yosupot