結果
問題 |
No.2320 Game World for PvP
|
ユーザー |
|
提出日時 | 2023-05-28 20:25:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,146 bytes |
コンパイル時間 | 1,922 ms |
コンパイル使用メモリ | 197,824 KB |
最終ジャッジ日時 | 2025-02-13 15:53:34 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 4 WA * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf(" %d %d %d", &N, &s, &t); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf(" %d", &a); | ~~~~~^~~~~~~~~~~ main.cpp:18:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf(" %d", &a); | ~~~~~^~~~~~~~~~~ main.cpp:32:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 32 | scanf(" %lld", &C[i][j]); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std ; random_device rd; mt19937 eng(rd()); uniform_real_distribution<> prr; int main () { clock_t st = clock(); int N, s, t; scanf(" %d %d %d", &N, &s, &t); std::vector<int> id(N, -1); for (int i = 0; i < s; i ++) { int a; scanf(" %d", &a); id[--a] = 0; } for (int i = 0; i < t; i ++) { int a; scanf(" %d", &a); id[--a] = 1; } for (auto& a : id) { if (a == -1) { double x = prr(eng); a = (x < 0.5); } } using ll = long long; ll C[66][66]; ll sum = 0; for (int i = 0; i < N; i ++) { for (int j = 0; j < N; j ++) { scanf(" %lld", &C[i][j]); if (i <= j) sum += C[i][j]; } } ll now = 0; for (int i = 0; i < N; i ++) { for (int j = i; j < N; j ++) { if (id[i] != id[j]) { now += C[i][j]; } } } ll ans = now; while ((double)(clock() - st) / CLOCKS_PER_SEC < 1.9) { int u = prr(eng) * N; ll pl = 0; for (int i = 0; i < N; i ++) { pl += C[i][u] * (id[u] == id[i] ? 1 : -1); } double x = (pl > 0 ? 2 : exp(10.0 * pl / sum)); if (prr(eng) < x) { now += pl; id[u] ^= 1; } ans = min(ans, now); } cout << sum - ans << endl; }