#include <bits/stdc++.h>
#include "popa.h"
#define N 1005
using namespace std;
int L[N],R[N];
int lgroup[N],rgroup[N];
int f(int l,int r){
if(l > r)return -1;
for(int i = l;i<=r;i++){
if(rgroup[i] == rgroup[r] && lgroup[i] == lgroup[l]){
L[i] = f(l,i-1);
R[i] = f(i+1,r);
return i;
}
}
}
int solve(int n, int* Left, int* Right){
return 0;
for(int i = 0;i<n;i++){
L[i] = R[i] = -1;
}
int cnt = 1;
return 0;
for(int i = 0;i<n;i++){
int r = i;
while(r + 1 != n && query(i,r+1,i,i))
r++;
for(int j = i;j<=r;j++){
rgroup[j] = cnt;
}
cnt++;
i = r;
}
return 0;
cnt = 1;
for(int i = n-1;i>=0;i--){
int l = i;
while(l - 1 != -1 && query(l-1,i,i,i))
l--;
for(int j = l;j<=i;j++){
lgroup[j] = cnt;
}
cnt++;
i = l;
}
int ret = f(0,n-1);
for(int i = 0;i<n;i++){
Left[i] = L[i];
Right[i] = R[i];
}
return ret;
}
Compilation message
popa.cpp: In function 'int f(int, int)':
popa.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
16 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
316 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
292 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |