結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー dnishdnish
提出日時 2018-06-04 18:39:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 804 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 86,120 KB
実行使用メモリ 25,220 KB
平均クエリ数 3.70
最終ジャッジ日時 2024-07-17 01:45:48
合計ジャッジ時間 3,913 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;

int N,K;
int ans,now;
vector<int> vt;
int main() {
    cin>>N>>K;
    for(int i=0;N-1-(K+1)*i>=0;i++){
        vt.push_back(N-1-(K+1)*i);
    }
    reverse(vt.begin(),vt.end());
    p(vt[0]);
    while(1){
        cin>>now;
        if(now>=N) break;
        p(*upper_bound(vt.begin(), vt.end(), now));
    }
    return 0;
}
0