結果
| 問題 | 
                            No.1425 Yet Another Cyclic Shifts Sorting
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tails
                         | 
                    
| 提出日時 | 2021-03-15 11:43:26 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 737 bytes | 
| コンパイル時間 | 1,126 ms | 
| コンパイル使用メモリ | 29,696 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-07 00:23:02 | 
| 合計ジャッジ時間 | 2,358 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 48 | 
コンパイルメッセージ
main.c:7:1: warning: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'main':
main.c:18:33: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   18 |                                 write(1,"2",1);
      |                                 ^~~~~
main.c:19:33: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   19 |                                 _exit(0);
      |                                 ^~~~~
      |                                 _Exit
            
            ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char*mmap();
#define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
main(){
	char*rp=mmap(0l,1l<<28,1,2,0,0ll);
	RD(n);
	--n;
	RD(c);
	int b=c,d;
	while(n){
		--n;
		RD(a);
		if(a<b){
			if(a>c){
				write(1,"2",1);
				_exit(0);
			}else{
				d=b;
				b=a;
				goto l1;
			}
		}
		b=a;
	}
	write(1,"0",1);
	_exit(0);
	l1:;
	while(n){
		--n;
		RD(a);
		if(a<b){
			write(1,"2",1);
			_exit(0);
		}
		if(a>c){
			if(a<d){
				write(1,"2",1);
				_exit(0);
			}else{
				b=a;
				goto l2;
			}
		}
		b=a;
	}while(*rp);
	write(1,"1",1);
	_exit(0);
	l2:;
	while(n){
		--n;
		RD(a);
		if(a<b){
			write(1,"2",1);
			_exit(0);
		}
		b=a;
	}
	write(1,"1",1);
	_exit(0);
}
            
            
            
        
            
tails