結果

問題 No.1392 Don't be together
コンテスト
ユーザー chineristAC
提出日時 2021-02-12 00:13:31
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 975 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,245 ms
コンパイル使用メモリ 271,680 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-17 19:35:48
合計ジャッジ時間 6,770 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include"testlib.h"
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<random>
#include<stdio.h>
using namespace std;

typedef long long ll;
const long long MIN_N = 2;
const long long MAX_N = 5000;
const long long MIN_M = 1;
const long long MAX_M = 5000;
const long long MIN_a = 0;
const long long MAX_a = 1000000000;

void validate(){
  long long N = inf.readLong(MIN_N,MAX_N);
  inf.readSpace();
  long long M = inf.readLong(1,N);
  inf.readEoln();

  set<ll> P;
  long long p;
  for (long long i=0;i<N;i++){
    p = inf.readLong(1,N);

    if (p==i+1){
      inf.readEof();
    }

    if (P.find(p)!=P.end()){
      inf.readEof();
    }
    else{
      P.insert(p);
    }

    if (i!=N-1){
      inf.readSpace();
    }
    else{
      inf.readEoln();
    }
  }
  inf.readEof();
}

int main(int argc, char* argv[]){
  registerValidation(argc,argv);
  validate();
}
0