| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 315735 | DanerZein | Bajka (COCI20_bajka) | C++14 | 1 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
string x,y;
cin>>x>>y;
int id=-1;
for(int i=0;i<x.size();i++){
if(x[i]==y[0]){
id=i;
break;
}
}
if(id==-1) {cout<<"-1\n";
return 0;}
int j=1;
bool sw=0;
int res=0;
while(true){
if(j==m) break;
if(id+1<n && x[id+1]==y[j]){
id++;
j++;
}
else
if(id-1>=0 && x[id-1]==y[j]){
id--;
j++;
}
else{
sw=1;
break;
}
res++;
}
if(sw==1) cout<<"-1\n";
else cout<<res<<endl;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
