Submission #224120

# Submission time Handle Problem Language Result Execution time Memory
224120 2020-04-17T08:24:07 Z tqbfjotld Fire (JOI20_ho_t5) C++14
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

int arr[200005];
int ans[200005];
vector<pair<pair<int,pair<int,int> >,int> > queries;

int main(){
    int n,q;
    scanf("%d%d",&n,&q);
    if (n<=200 && q<=200){
        for (int x = 1; x<=n; x++){
            scanf("%d",&arr[x]);
        }
        for (int x = 0; x<q; x++){
            int a,b,c;
            scanf("%d%d%d",&a,&b,&c);
            queries.push_back({{a,{b,c}},x});
        }
        sort(queries.begin(),queries.end());
        int cur = 0;
        for (auto x : queries){
            while (x.first.first>cur){
                cur++;
                for (int y = n; y>=2; y--){
                    arr[y] = max(arr[y],arr[y-1]);
                    //printf("%d ",arr[y]);
                }
                //printf("\n");
            }
             ans[x.second] = 0;
            for (int y = x.first.second.first; y<=x.first.second.second; y++){
                ans[x.second] += arr[y];
            }
        }
        for (int x = 0; x<q; x++){
            printf("%d\n",ans[x]);
        }
    }
}

Compilation message

ho_t5.cpp: In function 'int main()':
ho_t5.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&q);
     ~~~~~^~~~~~~~~~~~~~
ho_t5.cpp:13:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&arr[x]);
             ~~~~~^~~~~~~~~~~~~~
ho_t5.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d%d%d",&a,&b,&c);
             ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -