Submission #344933

# Submission time Handle Problem Language Result Execution time Memory
344933 2021-01-06T19:08:23 Z kkk Divide and conquer (IZhO14_divide) C++14
48 / 100
1000 ms 2924 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++)
        {
            //cout<<i<<" "<<j<<" "<<m[i][0]<<" "<<m[i][1]<<" "<<m[i][2]<<" "<<m[j][0]<<" "<<m[j][1]<<" "<<m[j][2]<<endl;
            if(m[j][2]-m[i-1][2]>=m[j][0]-m[i][0])
            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 0 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 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 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 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 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 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 492 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 2 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 2 ms 364 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 492 KB Output is correct
23 Correct 15 ms 620 KB Output is correct
24 Correct 15 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 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 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 492 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 2 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 2 ms 364 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 492 KB Output is correct
23 Correct 15 ms 620 KB Output is correct
24 Correct 15 ms 640 KB Output is correct
25 Correct 18 ms 620 KB Output is correct
26 Correct 67 ms 748 KB Output is correct
27 Correct 65 ms 1004 KB Output is correct
28 Execution timed out 1091 ms 2924 KB Time limit exceeded
29 Halted 0 ms 0 KB -