QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#518413 | #1822. Mountainous Palindromic Subarray | AA_Surely# | RE | 0ms | 3732kb | C++23 | 1.2kb | 2024-08-13 20:17:25 | 2024-08-13 20:17:25 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define FOR(i, x, n) for(int i = x; i < n; i++)
#define F0R(i, n) FOR(i, 0, n)
#define ROF(i, x, n) for(int i = n - 1; i >= x; i--)
#define R0F(i, n) ROF(i, 0, n)
#define WTF cout << "WTF" << endl
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define F first
#define S second
#define PB push_back
#define EP emplace_back
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef complex<LD> Point;
const int N = 2e5 + 7;
const int INF = 1e9 + 7;
const int LOG = 22;
const int A = 26;
const int SQ = 320;
const int MOD = 1e9 + 7;
int n;
int ns[N];
int main() {
IOS;
cin >> n;
F0R(i, n) cin >> ns[i];
int ans = -1;
F0R(i, n) {
FOR(j, 1, n) {
if (i - j < 0 || i + j >= n) break;
if (ns[i - j] != ns[i + j]) break;
if (ns[i - j] >= ns[i - j + 1]) break;
ans = max(ans, j * 2 + 1);
}
}
cout <<ans;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
8 2 1 2 3 2 1 7 8
output:
5
result:
ok answer is '5'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 2 5 8 7 2
output:
-1
result:
ok answer is '-1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
1 19
output:
-1
result:
ok answer is '-1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
7 1 3 3 6 3 3 1
output:
3
result:
ok answer is '3'
Test #5:
score: -100
Runtime Error
input:
1000000 165433750 1777 3027 4728 5361 5786 7362 9607 9677 11454 14653 17660 17850 20040 20308 23086 24094 24932 26077 28457 31075 34172 36822 39903 42332 45556 47062 48192 48377 49228 51441 54308 56872 59989 61711 64405 65454 68314 70649 71749 72331 73681 74108 74478 76909 80194 82588 85815 87670 89...