Submission #719696

# Submission time Handle Problem Language Result Execution time Memory
719696 2023-04-06T13:50:24 Z lam Team Contest (JOI22_team) C++14
27 / 100
194 ms 5548 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 1e5 + 5e4 + 10;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
#define ff first
#define ss second
int n;
iii a[maxn];
vector <iii> d;
map<ii,bool> mp;
int mmin[maxn],mmax[maxn];
void add(iii x)
{
    int y = x.ss.ff;
    for (int i=y; i<=300; i++) mmax[i]=max(mmax[i],x.ss.ss);
    mmin[y]=min(mmin[y],x.ss.ss);
}
int query(iii x)
{
    int y=x.ss.ff;
    int ans=-1;
    for (int i=y+1; i<=300; i++)
        if (mmin[i]!=1e9&&mmax[i-1]!=-1e9&&mmax[i-1]>mmin[i]&&mmax[i-1]>x.ss.ss) ans=max(ans,mmax[i-1]+i+x.ff);
    return ans;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cin>>n;
    for (int i=1; i<=n; i++) cin>>a[i].ff>>a[i].ss.ff>>a[i].ss.ss;
    for (int i=0; i<=4000; i++)
        mmin[i] = 1e9, mmax[i]=-1e9;
    sort(a+1,a+n+1);
    d.clear();
    int l,r;
    int ans=-1;
    for (int i=1; i<=n; i++)
    {
        if (i==1||a[i].ff!=a[i-1].ff) l=i;
        if (i==n||a[i].ff!=a[i+1].ff)
        {
            r=i;
            for (int j=l; j<=r; j++) ans=max(ans,query(a[j]));
            for (int j=l; j<=r; j++) add(a[j]);
        }
    }
    cout<<ans<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 456 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Runtime error 1 ms 596 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 456 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Runtime error 1 ms 596 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 121 ms 3816 KB Output is correct
12 Correct 98 ms 2736 KB Output is correct
13 Correct 97 ms 3284 KB Output is correct
14 Correct 122 ms 3896 KB Output is correct
15 Correct 119 ms 3964 KB Output is correct
16 Correct 168 ms 3912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 121 ms 3816 KB Output is correct
12 Correct 98 ms 2736 KB Output is correct
13 Correct 97 ms 3284 KB Output is correct
14 Correct 122 ms 3896 KB Output is correct
15 Correct 119 ms 3964 KB Output is correct
16 Correct 168 ms 3912 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 145 ms 3900 KB Output is correct
23 Correct 140 ms 3820 KB Output is correct
24 Correct 99 ms 2940 KB Output is correct
25 Correct 194 ms 3924 KB Output is correct
26 Correct 151 ms 3908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 121 ms 3816 KB Output is correct
12 Correct 98 ms 2736 KB Output is correct
13 Correct 97 ms 3284 KB Output is correct
14 Correct 122 ms 3896 KB Output is correct
15 Correct 119 ms 3964 KB Output is correct
16 Correct 168 ms 3912 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 145 ms 3900 KB Output is correct
23 Correct 140 ms 3820 KB Output is correct
24 Correct 99 ms 2940 KB Output is correct
25 Correct 194 ms 3924 KB Output is correct
26 Correct 151 ms 3908 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 3 ms 468 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 169 ms 3740 KB Output is correct
35 Correct 167 ms 4996 KB Output is correct
36 Correct 158 ms 5436 KB Output is correct
37 Correct 105 ms 5548 KB Output is correct
38 Correct 72 ms 5280 KB Output is correct
39 Correct 57 ms 3492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 121 ms 3816 KB Output is correct
12 Correct 98 ms 2736 KB Output is correct
13 Correct 97 ms 3284 KB Output is correct
14 Correct 122 ms 3896 KB Output is correct
15 Correct 119 ms 3964 KB Output is correct
16 Correct 168 ms 3912 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 145 ms 3900 KB Output is correct
23 Correct 140 ms 3820 KB Output is correct
24 Correct 99 ms 2940 KB Output is correct
25 Correct 194 ms 3924 KB Output is correct
26 Correct 151 ms 3908 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 3 ms 468 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 169 ms 3740 KB Output is correct
35 Correct 167 ms 4996 KB Output is correct
36 Correct 158 ms 5436 KB Output is correct
37 Correct 105 ms 5548 KB Output is correct
38 Correct 72 ms 5280 KB Output is correct
39 Correct 57 ms 3492 KB Output is correct
40 Incorrect 2 ms 476 KB Output isn't correct
41 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 456 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Runtime error 1 ms 596 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -