結果
| 問題 | No.365 ジェンガソート |
| コンテスト | |
| ユーザー |
mannshi222
|
| 提出日時 | 2019-07-14 19:28:57 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,226 bytes |
| 記録 | |
| コンパイル時間 | 232 ms |
| コンパイル使用メモリ | 29,952 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-24 13:37:24 |
| 合計ジャッジ時間 | 18,223 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 26 TLE * 1 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#define ENDD '\0'
#define KIGY '\n'
#define TRUE 0
#define FALSE 1
int main()
{
int ch;
char buff[100000+1];
int buffi;
int N;
int jen[100000+1];
buffi = 0;
while( (ch=getc(stdin)) != KIGY) {
buff[buffi++] = ch;
}
buff[buffi] = ENDD;
N = atoi(buff);
buffi=0;
int count = 1;
while( (ch=getc(stdin)) != EOF) {
if( ch==' ' || ch==KIGY ) {
buff[buffi] = ENDD;
jen[atoi(buff)] = count++;
buffi = 0;
}
else {
buff[buffi++] = ch;
}
}
count = 0;
for( int i = N; i >=2; i-- ) {
if( jen[i] > jen[i-1] ) {
continue;
}
count++;
jen[i-1] = 1;
for( int j = 1; j <= i-2; j++ ) {
jen[j]--;
}
}
/* search max */
printf("%d\n", count );
return 0;
}
mannshi222