답안 #242244

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
242244 2020-06-27T07:26:43 Z tqbfjotld 3단 점프 (JOI19_jumps) C++14
5 / 100
41 ms 2040 KB
#include <bits/stdc++.h>
using namespace std;

long long arr[500005];

int main(){
    int n,q;
    scanf("%d",&n);
    for (int x = 0; x<n; x++){
        scanf("%lld",&arr[x]);
    }
    scanf("%d",&q);
    if (n<=100 && q<=100){
        for (int x = 0; x<q; x++){
            int l,r;
            scanf("%d%d",&l,&r);
            l--;r--;
            long long ans = 0;
            for (int a = l; a<=r; a++){
                for (int c = a+2; c<=r; c++){
                    for (int b = a+1; c-b>=b-a; b++){
                        ans = max(ans,arr[a]+arr[b]+arr[c]);
                    }
                }
            }
            printf("%lld\n",ans);
        }
    }
}

Compilation message

jumps.cpp: In function 'int main()':
jumps.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
jumps.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&arr[x]);
         ~~~~~^~~~~~~~~~~~~~~~
jumps.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&q);
     ~~~~~^~~~~~~~~
jumps.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d%d",&l,&r);
             ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 256 KB Output is correct
11 Incorrect 5 ms 384 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 41 ms 2040 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 256 KB Output is correct
11 Incorrect 5 ms 384 KB Output isn't correct
12 Halted 0 ms 0 KB -