結果
問題 | No.1619 Coccinellidae |
ユーザー |
|
提出日時 | 2021-08-09 23:30:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 126 ms / 2,000 ms |
コード長 | 343 bytes |
コンパイル時間 | 578 ms |
コンパイル使用メモリ | 64,032 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 22:35:38 |
合計ジャッジ時間 | 2,927 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int N; long M,K; int ans[1<<17],tmp[1<<17]; main() { cin>>N>>M>>K; M-=(long)N*(N-1)/2; for(int i=0;i<N;i++)tmp[i]=i; int l=0,r=N; for(int i=0;i<N;i++) { if(r-l-1<=K) { K-=r-l-1; ans[i]=tmp[--r]; } else ans[i]=tmp[l++]; } for(int i=0;i<N;i++)cout<<ans[i]+(ans[i]==N-1?M:0)<<endl; }