結果
| 問題 |
No.3115 One Power One Kill
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-04-21 15:18:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,159 bytes |
| コンパイル時間 | 993 ms |
| コンパイル使用メモリ | 74,948 KB |
| 実行使用メモリ | 26,252 KB |
| 平均クエリ数 | 2.00 |
| 最終ジャッジ日時 | 2025-04-21 15:18:21 |
| 合計ジャッジ時間 | 5,758 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:63:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
63 | scanf("%d", &k);
| ~~~~~^~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 3115.cc: No.3115 One Power One Kill - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<vector>
#include<algorithm>
using namespace std;
/* constant */
const int MIN_X = 100;
const int MAX_X = 100000;
const int MOD = 1000000007;
/* typedef */
using vb = vector<bool>;
using vi = vector<int>;
/* typedef */
/* global variables */
vb primes;
vi pnums;
/* subroutines */
int gen_primes(int maxp) {
primes.assign(maxp + 1, true);
primes[0] = primes[1] = false;
int p;
for (p = 2; p * p <= maxp; p++)
if (primes[p]) {
pnums.push_back(p);
for (int q = p * p; q <= maxp; q += p) primes[q] = false;
}
for (; p <= maxp; p++)
if (primes[p]) pnums.push_back(p);
return (int)pnums.size();
}
/* main */
int main() {
int pn = gen_primes(MAX_X);
int pk = lower_bound(pnums.begin(), pnums.end(), MIN_X + 1) - pnums.begin();
srand(time(nullptr));
int p = pnums[rand() % (pn - pk) + pk];
printf("%d %d\n", p - 1, p); fflush(stdout);
int k;
scanf("%d", &k);
puts("1"); fflush(stdout);
//for (int i = 0; i < 1e9; i++);
return 0;
}
tnakao0123