結果
| 問題 |
No.3155 Same Birthday
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-13 17:24:29 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,246 bytes |
| コンパイル時間 | 2,987 ms |
| コンパイル使用メモリ | 281,528 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-05-13 17:58:53 |
| 合計ジャッジ時間 | 48,153 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 41 WA * 8 |
ソースコード
// TLE嘘(逆順)
#include <bits/stdc++.h>
using namespace std;
using Clock = std::chrono::steady_clock;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
std::random_device rnd; // 非決定的な乱数生成器を生成
std::mt19937 mt(rnd()); // メルセンヌ・ツイスタの32ビット版、引数は初期シード値
std::uniform_int_distribution<> rand1(0,1);
int N;
if (!(cin >> N)) return 0;
vector<pair<int,int>> v(N);
for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;
const auto start = Clock::now();
const auto LIMIT = std::chrono::milliseconds(1900); // 1.9 秒
for (int i = N - 1; i >= 0; --i) {
for (int j = i - 1; j >= 0; --j) {
if (v[i] == v[j]) { // 同じ誕生月・誕生日を発見
cout << "Yes\n";
return 0;
}
}
// 外側ループごとに時間チェッ
if (Clock::now() - start > LIMIT) {
if (rand1(mt)==1){
cout << "Yes\n";
} else {
cout << "No\n";
}
return 0;
}
}
// 全探索完了(重複なし)
cout << "No\n";
return 0;
}