結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  NaruY | 
| 提出日時 | 2018-05-15 20:37:14 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 13 ms / 2,000 ms | 
| コード長 | 938 bytes | 
| コンパイル時間 | 1,370 ms | 
| コンパイル使用メモリ | 157,404 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-28 12:10:47 | 
| 合計ジャッジ時間 | 2,690 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 41 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:28: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int’ [-Wformat=]
   13 | #define PRINTLLD(n) printf("%lld\n",n)
      |                            ^~~~~~~~
main.cpp:39:9: note: in expansion of macro ‘PRINTLLD’
   39 |         PRINTLLD(N-d);
      |         ^~~~~~~~
main.cpp:13:32: note: format string is defined here
   13 | #define PRINTLLD(n) printf("%lld\n",n)
      |                             ~~~^
      |                                |
      |                                long long int
      |                             %d
main.cpp:5:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 | #define SCD(n) scanf("%d",&n)
      |                ~~~~~^~~~~~~~~
main.cpp:25:16: note: in expansion of macro ‘SCD’
   25 |         int N; SCD(N);
      |                ^~~
main.cpp:5:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 | #define SCD(n) scanf("%d",&n)
      |                ~~~~~^~~~~~~~~
main.cpp:11:33: note: in expansion of macro ‘SCD’
   11 | #define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
      |                                 ^~~
main.cpp:30:9: note: in expansion of macro ‘ARSCD1’
   30 |         ARSCD1(a,N);
      |         ^~~~~~
            
            ソースコード
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
int main(){
	int N; SCD(N);
	static int a[100005];
	int d = 0;
	int nows = N;
	
	ARSCD1(a,N);
	
	for (int i = N ; i > 0 ; i--){
		if (a[i] == nows){
			d++;
			nows--;
		}
	}
	
	PRINTLLD(N-d);
	return 0;
}
            
            
            
        