結果
問題 | No.504 ゲーム大会(ランキング) |
ユーザー |
![]() |
提出日時 | 2018-08-18 01:24:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 376 bytes |
コンパイル時間 | 2,060 ms |
コンパイル使用メモリ | 36,096 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 19:32:40 |
合計ジャッジ時間 | 1,762 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&N); | ~~~~~^~~~~~~~~ main.cpp:11:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | for(int i=0;i<N;i++)scanf("%d",&a[i]); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio> #include <vector> using namespace std; int main(){ int N; scanf("%d",&N); vector<int> a(N); vector<int> rank(N); for(int i=0;i<N;i++)scanf("%d",&a[i]); rank[0]=1; for(int i=1;i<N;i++){ if(a[i]>a[0])rank[i]=rank[i-1]+1; else rank[i]=rank[i-1]; } for(int i=0;i<N;i++)printf("%d\n",rank[i]); return 0; }