Submission #699200

# Submission time Handle Problem Language Result Execution time Memory
699200 2023-02-16T05:34:20 Z Elrawy1 Art Exhibition (JOI18_art) C++17
50 / 100
1000 ms 35436 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str ;
typedef double db;
#define endl '\n';
const int N=1e5+4;
const double pi=3.14159265359;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

int n;
cin>>n;
map<ll,ll>x;
ll sum=0;
ll d[n];
for(int i=0;i<n;i++){
    ll m,k;
    cin>>m>>k;
    sum+=k;
    x[m]+=k;
    d[i]=m;

}
 ll j=sum;

sort(d,d+n);
ll Max=0,s,o;
for(int h=0;h<n;h++){
    sum=j;

for(int i=n-1;i>=h;i--){

        s = d[i] - d[h];
        Max = max(Max, (sum - s));
        sum -= x[d[i]];


    }
j-=x[d[h]];

}

cout<<Max;


}

Compilation message

art.cpp: In function 'int main()':
art.cpp:29:12: warning: unused variable 'o' [-Wunused-variable]
   29 | ll Max=0,s,o;
      |            ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 284 KB Output is correct
7 Correct 0 ms 216 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 216 KB Output is correct
11 Correct 0 ms 220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 284 KB Output is correct
7 Correct 0 ms 216 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 216 KB Output is correct
11 Correct 0 ms 220 KB Output is correct
12 Correct 1 ms 216 KB Output is correct
13 Correct 1 ms 352 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 352 KB Output is correct
17 Correct 1 ms 352 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 284 KB Output is correct
7 Correct 0 ms 216 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 216 KB Output is correct
11 Correct 0 ms 220 KB Output is correct
12 Correct 1 ms 216 KB Output is correct
13 Correct 1 ms 352 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 352 KB Output is correct
17 Correct 1 ms 352 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 480 ms 652 KB Output is correct
28 Correct 482 ms 648 KB Output is correct
29 Correct 483 ms 648 KB Output is correct
30 Correct 505 ms 656 KB Output is correct
31 Correct 497 ms 652 KB Output is correct
32 Correct 472 ms 648 KB Output is correct
33 Correct 485 ms 644 KB Output is correct
34 Correct 490 ms 596 KB Output is correct
35 Correct 469 ms 656 KB Output is correct
36 Correct 494 ms 716 KB Output is correct
37 Correct 470 ms 644 KB Output is correct
38 Correct 472 ms 652 KB Output is correct
39 Correct 492 ms 644 KB Output is correct
40 Correct 477 ms 648 KB Output is correct
41 Correct 475 ms 648 KB Output is correct
42 Correct 503 ms 648 KB Output is correct
43 Correct 472 ms 648 KB Output is correct
44 Correct 488 ms 648 KB Output is correct
45 Correct 472 ms 648 KB Output is correct
46 Correct 482 ms 648 KB Output is correct
47 Correct 489 ms 648 KB Output is correct
48 Correct 485 ms 644 KB Output is correct
49 Correct 492 ms 648 KB Output is correct
50 Correct 502 ms 648 KB Output is correct
51 Correct 540 ms 664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 284 KB Output is correct
7 Correct 0 ms 216 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 216 KB Output is correct
11 Correct 0 ms 220 KB Output is correct
12 Correct 1 ms 216 KB Output is correct
13 Correct 1 ms 352 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 352 KB Output is correct
17 Correct 1 ms 352 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 480 ms 652 KB Output is correct
28 Correct 482 ms 648 KB Output is correct
29 Correct 483 ms 648 KB Output is correct
30 Correct 505 ms 656 KB Output is correct
31 Correct 497 ms 652 KB Output is correct
32 Correct 472 ms 648 KB Output is correct
33 Correct 485 ms 644 KB Output is correct
34 Correct 490 ms 596 KB Output is correct
35 Correct 469 ms 656 KB Output is correct
36 Correct 494 ms 716 KB Output is correct
37 Correct 470 ms 644 KB Output is correct
38 Correct 472 ms 652 KB Output is correct
39 Correct 492 ms 644 KB Output is correct
40 Correct 477 ms 648 KB Output is correct
41 Correct 475 ms 648 KB Output is correct
42 Correct 503 ms 648 KB Output is correct
43 Correct 472 ms 648 KB Output is correct
44 Correct 488 ms 648 KB Output is correct
45 Correct 472 ms 648 KB Output is correct
46 Correct 482 ms 648 KB Output is correct
47 Correct 489 ms 648 KB Output is correct
48 Correct 485 ms 644 KB Output is correct
49 Correct 492 ms 648 KB Output is correct
50 Correct 502 ms 648 KB Output is correct
51 Correct 540 ms 664 KB Output is correct
52 Execution timed out 1086 ms 35436 KB Time limit exceeded
53 Halted 0 ms 0 KB -