結果

問題 No.1859 ><<<
ユーザー tsuishi
提出日時 2022-03-03 17:09:22
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 539 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 193 ms
コンパイル使用メモリ 38,112 KB
最終ジャッジ日時 2026-02-22 08:50:12
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 WA * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
char str[600004];
char shi[300004];
int main(){
	long lN;
	long gt;
	int	num;
	int scc;
	scanf("%ld",&lN);
	for(long i=0L; i < lN; ++i){
		scanf("%d",&num);
		num += '0';
		str[ i + lN ] = str[ i ] = num;
	}
	scanf("%s",shi);
	for( gt=0;gt< lN; gt++ ) {
		scc = 1;
		for(long i=0L; i < lN-1; ++i){
			if( shi[i] == '>' ) {
				if( str[i+gt] < str[ i+gt+1 ] ) { scc=0; break; }
			} else {
				if( str[i+gt] > str[ i+gt+1 ] ) { scc=0; break; }
			}
		}
		if( scc ) break;
	}
	if( !scc ) gt = -1;
	printf("%ld\n", gt );
}
0