Submission #344930

# Submission time Handle Problem Language Result Execution time Memory
344930 2021-01-06T19:00:20 Z kkk Divide and conquer (IZhO14_divide) C++14
17 / 100
1 ms 492 KB
#include<iostream>
#include<cstring>
#define endl '\n'
using namespace std;
long long m[100003][4],dp[100003],used[5002],n;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long i,mm=0,maxi=0,j;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>m[i][0]>>m[i][1]>>m[i][2];
        if(i!=1){m[i][1]+=m[i-1][1];
        m[i][2]+=m[i-1][2];}
    }
    for(i=1;i<=n;i++)
    {
        for(j=i;j<=n;j++)
        {
           
            if(m[j][2]-m[i-1][2]<m[j][0]-m[i][0])break;
            maxi=max(maxi,m[j][1]-m[i-1][1]);
        }
    }
    cout<<maxi<<endl;


}

Compilation message

divide.cpp: In function 'int main()':
divide.cpp:12:17: warning: unused variable 'mm' [-Wunused-variable]
   12 |     long long i,mm=0,maxi=0,j;
      |                 ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 380 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 380 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 380 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -