# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
223375 | 2020-04-15T08:21:50 Z | rainy | Lampice (COCI19_lampice) | C++17 | 26 ms | 2048 KB |
#include<bits/stdc++.h> #define MAXN 50005 #define pb push_back using namespace std; typedef vector<int> vi; int N,A,B; char c[MAXN]; map<char,vi> mp; int nx[MAXN]; int main(){ scanf("%d",&N); for(int i=0;i<N;i++){ scanf(" %c",&c[i]); mp[c[i]].pb(i); } for(int i=0;i<N;i++){ auto it=upper_bound(mp[c[i]].begin(), mp[c[i]].end(),i); if(it==mp[c[i]].end())nx[i]=-1; else nx[i]=*it; } for(int i=0;i<N-1;i++){ scanf("%d%d",&A,&B); assert(abs(A-B)==1); } int si=0; int ans=1; for(int j=1;j<N;j++){ if(nx[j]!=nx[j-1]-1){ if(nx[j-1]-(j-1)==1){ ans=max(ans, 2*(j-si)); } else if(nx[j-1]-(j-1)==2){ ans=max(ans, 2*(j-si)+1); } si=j; } } printf("%d\n",ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 1408 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 15 ms | 2048 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |