結果
| 問題 |
No.1859 ><<<
|
| ユーザー |
tsuishi
|
| 提出日時 | 2022-03-03 19:00:33 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 2,135 bytes |
| コンパイル時間 | 328 ms |
| コンパイル使用メモリ | 30,464 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-17 15:25:44 |
| 合計ジャッジ時間 | 4,706 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 41 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// for debug
#define DEBUGs
// -----------
#define NOP do{}while(0)
#ifdef DEBUGw
#include <time.h>
#define TRACE(...) do{printf(__VA_ARGS__);fflush(stdout);}while(0)
#define TRACECR do{putchar_unlocked('\n');fflush(stdout);}while(0)
static clock_t startclock;
void DEBUGSTART(void){TRACE("--DEBUG MODE --\n");startclock=clock();}
void DEBUGEND(void){startclock=clock()-startclock;TRACE("--finish --\ntime is %.3fms\n",startclock/1000.);}
#else
#define TRACE(...) NOP
#define TRACECR NOP
void DEBUGSTART(void){return;}
void DEBUGEND(void){return;}
#endif
extern int getchar_unlocked(void);
extern int putchar_unlocked(int);
#define PRINCR do{printf("\n");fflush(stdout);}while(0)
#define GETLINE(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
#define REP(a,b) for(int a=0;a<(int)(b);++a)
static char *GETWORD(char* str) {char c;char *cp;cp=&str[0];c=fgetc(stdin);while( c != EOF ){if((c==' ')||( c=='\n')) break;*cp++=c;c=fgetc(stdin);}*cp='\0';return &str[0];}
#define GETINTS(a,b) {char s[34];int *ap=a;REP(i,b){GETWORD(s);sscanf(s,"%d", ap);ap++;}}
static int GETLINEINT(void) {char s[34];GETLINE(s);return atoi(s);}
static int GETWORDINT(void) {char s[34];GETWORD(s);return atoi(s);}
#define SWAP(type,a,b) do{type _c;_c=a;a=b;b=_c;}while(0)
char sdn[600004];
char shi[300004];
int main(){
long lN;
long gt;
int num;
int scc;
char *cp0,*cpc0,*cpc1;
int iFirst,iPrev,iNow,iEnd;
scanf("%ld\n",&lN);
cp0 = sdn;
iFirst = GETWORDINT();
iPrev = iFirst;
for(long i=1L; i < lN-1; ++i){
iNow = GETWORDINT();
if( iPrev < iNow ) {
*cp0++ = '<';
} else {
*cp0++ = '>';
}
iPrev = iNow;
//TRACE("%d,",sdn[i]);
}
iEnd = GETWORDINT();
if( iPrev < iEnd ) {
*cp0++ = '<';
} else {
*cp0++ = '>';
}
if( iEnd < iFirst ) {
*cp0++ = '<';
} else {
*cp0++ = '>';
}
cpc0 = sdn;
for(long i=0L; i < lN; ++i){
*cp0++ = *cpc0++;
}
*cp0 = '\0';
GETLINE(shi);
TRACE("%s\n",shi);
cpc0 = strstr( sdn , shi );
if( cpc0 == NULL ) {
gt = -1;
} else {
gt = (long)(cpc0 - sdn);
}
printf("%ld\n", gt );
}
tsuishi