# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1012505 |
2024-07-02T09:04:21 Z |
Rifal |
Triple Jump (JOI19_jumps) |
C++14 |
|
4000 ms |
3668 KB |
#include <bits/stdc++.h>
#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define INF 1000000000
#define INF2 2000000000
#define fi first
#define se second
using namespace std;
double const EPS = 1e-14;
const int P = 1007;
typedef long long ll;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key
int main()
{
ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
int n; cin >> n; ll arr[n+1];
for(int i = 1; i <= n; i++) {
cin >> arr[i];
}
int q; cin >> q;
while(q--) {
int l, r; cin >> l >> r;
ll mx = 0;
for(int i = l; i <= r; i++) {
for(int j = i+1; j <= r; j++) {
for(int z = j+1; z <= r; z++) {
if(j-i <= z-j) mx = max(mx,arr[i]+arr[j]+arr[z]);
}
}
}
cout << mx << endl;
}
return 0;
}
/* int n, m; cin >> n >> m; char c[n+1][m+1]; int arr[n+1][m+1] = {};
ll cnt[n+1][m+1] = {};
int up[n+1][m+1];
ll sum = 0, mx = 0;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
cin >> c[i][j];
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
if(c[i][j] == '1') arr[i][j] = 1;
else arr[i][j] = 0;
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
int indx = i;
while(indx > 0 && arr[indx][j] != 0) {
indx--;
}
up[i][j] = indx;
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
int indx = j;
pair<int,int> mn = {INF,INF};
while(indx > 0 && arr[i][indx] == 1) {
if(mn.fi > i-up[i][indx]) {
mn.fi = i-up[i][indx];
mn.se = up[i][indx];
}
sum += mn.fi;
cnt[i][j]++;
cnt[mn.se][indx-1]++;
cnt[i][indx-1]--;
cnt[mn.se][j]--;
indx--;
}
}
}
for(int i = 1; i <= n; i++) {
for(int j = m-1; j >= 1; j--) {
cnt[i][j] += cnt[i][j+1];
}
}
for(int j = 1; j <= m; j++) {
for(int i = n-1; i >= 1; i--) {
cnt[i][j] += cnt[i+1][j];
mx = max(mx,cnt[i][j]);
}
}
cout << sum - mx << endl;*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
452 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
344 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
3 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
452 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
344 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
3 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Execution timed out |
4040 ms |
348 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4075 ms |
3668 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
452 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
344 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
3 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Execution timed out |
4040 ms |
348 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |