結果
| 問題 | No.365 ジェンガソート |
| コンテスト | |
| ユーザー |
mannshi222
|
| 提出日時 | 2019-07-14 19:42:03 |
| 言語 | C (gcc 15.2.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,308 bytes |
| 記録 | |
| コンパイル時間 | 668 ms |
| コンパイル使用メモリ | 29,568 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-11-24 14:13:12 |
| 合計ジャッジ時間 | 57,498 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 TLE * 17 |
ソースコード
#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++;
for( int j = 1; j <= N; j++ ) {
if( jen[i-1] > jen[j] ) {
jen[j]++;
}
}
jen[i-1] = 1;
}
/* search max */
printf("%d\n", count );
return 0;
}
mannshi222