답안 #596239

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
596239 2022-07-14T13:58:50 Z ibm2006 Team Contest (JOI22_team) C++14
0 / 100
1036 ms 1048576 KB
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long int ll;
ll n,z,t,i,j,x,y,a[1100000];
pair<ll,pair<ll,ll>> p[1100000];
map<pair<ll,pair<ll,ll>>,ll> m;
vector<pair<ll,ll>> u;
vector<pair<pair<ll,ll>,ll>> v[1100000];
set<pair<pair<ll,ll>,ll>> s;
int main()
{
    scanf("%lld",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%lld %lld %lld",&x,&y,&z);
        if(m[{x,{y,z}}]==1)
            continue;
        t++;
        p[t]={x,{y,z}};
    }
    z=0;
    n=t;
    sort(p+1,p+n+1);
    for(i=1;i<=n;i++)
    {
        s.insert({p[i].second,i});
        for(auto l=s.begin();l!=s.end();l++)
            v[i+1].push_back((*l));
    }

    for(i=1;i<=n;i++)
    {//printf("%lld",i);
        t=0;
        u.clear();
        for(j=0;j<(i-1);j++)
        {
            if(p[v[i][j].second].first==p[i].first)
                continue;
            if(v[i][j].first.first>p[i].second.first||v[i][j].first.second>p[i].second.second)
                {u.push_back(v[i][j].first);  t++; }
        }
        for(j=0;j<t;j++)
        {
            if(j==0)
                a[j]=u[j].second;
            else
                a[j]=max(a[j-1],u[j].second);
        }
        for(j=t-1;j>=1;j--)
        {
            if(u[j].second<a[j-1])
            {
                z=max(z,u[j].first+a[j-1]+p[i].first);

                break;
            }
        }
    }
    if(z==0)
        z=-1;
    printf("%lld",z);
}

Compilation message

team.cpp: In function 'int main()':
team.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
team.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%lld %lld %lld",&x,&y,&z);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 26068 KB Output is correct
2 Correct 14 ms 26084 KB Output is correct
3 Correct 14 ms 26068 KB Output is correct
4 Correct 16 ms 26108 KB Output is correct
5 Correct 17 ms 26148 KB Output is correct
6 Correct 13 ms 26068 KB Output is correct
7 Correct 14 ms 26112 KB Output is correct
8 Correct 13 ms 26068 KB Output is correct
9 Correct 14 ms 26068 KB Output is correct
10 Correct 13 ms 26096 KB Output is correct
11 Correct 13 ms 26056 KB Output is correct
12 Correct 13 ms 26068 KB Output is correct
13 Correct 13 ms 26068 KB Output is correct
14 Correct 19 ms 27760 KB Output is correct
15 Incorrect 17 ms 27088 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 26068 KB Output is correct
2 Correct 14 ms 26084 KB Output is correct
3 Correct 14 ms 26068 KB Output is correct
4 Correct 16 ms 26108 KB Output is correct
5 Correct 17 ms 26148 KB Output is correct
6 Correct 13 ms 26068 KB Output is correct
7 Correct 14 ms 26112 KB Output is correct
8 Correct 13 ms 26068 KB Output is correct
9 Correct 14 ms 26068 KB Output is correct
10 Correct 13 ms 26096 KB Output is correct
11 Correct 13 ms 26056 KB Output is correct
12 Correct 13 ms 26068 KB Output is correct
13 Correct 13 ms 26068 KB Output is correct
14 Correct 19 ms 27760 KB Output is correct
15 Incorrect 17 ms 27088 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 26068 KB Output is correct
2 Correct 13 ms 26068 KB Output is correct
3 Correct 12 ms 26068 KB Output is correct
4 Correct 17 ms 26144 KB Output is correct
5 Correct 15 ms 26152 KB Output is correct
6 Correct 15 ms 26104 KB Output is correct
7 Correct 14 ms 26116 KB Output is correct
8 Correct 12 ms 26068 KB Output is correct
9 Correct 16 ms 26068 KB Output is correct
10 Correct 16 ms 26104 KB Output is correct
11 Runtime error 1036 ms 1048576 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 26068 KB Output is correct
2 Correct 13 ms 26068 KB Output is correct
3 Correct 12 ms 26068 KB Output is correct
4 Correct 17 ms 26144 KB Output is correct
5 Correct 15 ms 26152 KB Output is correct
6 Correct 15 ms 26104 KB Output is correct
7 Correct 14 ms 26116 KB Output is correct
8 Correct 12 ms 26068 KB Output is correct
9 Correct 16 ms 26068 KB Output is correct
10 Correct 16 ms 26104 KB Output is correct
11 Runtime error 1036 ms 1048576 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 26068 KB Output is correct
2 Correct 13 ms 26068 KB Output is correct
3 Correct 12 ms 26068 KB Output is correct
4 Correct 17 ms 26144 KB Output is correct
5 Correct 15 ms 26152 KB Output is correct
6 Correct 15 ms 26104 KB Output is correct
7 Correct 14 ms 26116 KB Output is correct
8 Correct 12 ms 26068 KB Output is correct
9 Correct 16 ms 26068 KB Output is correct
10 Correct 16 ms 26104 KB Output is correct
11 Runtime error 1036 ms 1048576 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 26068 KB Output is correct
2 Correct 13 ms 26068 KB Output is correct
3 Correct 12 ms 26068 KB Output is correct
4 Correct 17 ms 26144 KB Output is correct
5 Correct 15 ms 26152 KB Output is correct
6 Correct 15 ms 26104 KB Output is correct
7 Correct 14 ms 26116 KB Output is correct
8 Correct 12 ms 26068 KB Output is correct
9 Correct 16 ms 26068 KB Output is correct
10 Correct 16 ms 26104 KB Output is correct
11 Runtime error 1036 ms 1048576 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 26068 KB Output is correct
2 Correct 14 ms 26084 KB Output is correct
3 Correct 14 ms 26068 KB Output is correct
4 Correct 16 ms 26108 KB Output is correct
5 Correct 17 ms 26148 KB Output is correct
6 Correct 13 ms 26068 KB Output is correct
7 Correct 14 ms 26112 KB Output is correct
8 Correct 13 ms 26068 KB Output is correct
9 Correct 14 ms 26068 KB Output is correct
10 Correct 13 ms 26096 KB Output is correct
11 Correct 13 ms 26056 KB Output is correct
12 Correct 13 ms 26068 KB Output is correct
13 Correct 13 ms 26068 KB Output is correct
14 Correct 19 ms 27760 KB Output is correct
15 Incorrect 17 ms 27088 KB Output isn't correct
16 Halted 0 ms 0 KB -