제출 #563552

#제출 시각아이디문제언어결과실행 시간메모리
563552clarenceTeam Contest (JOI22_team)C++17
100 / 100
122 ms7604 KiB
#include <cstdio>
#include <algorithm>
using namespace std;
int N;
int X[150010];
int Y[150010];
int Z[150010];
int SX[150010];
int SY[150010];
int SZ[150010];
bool cmpX(int a, int b) {
    return X[a]<X[b];
}
bool cmpY(int a, int b) {
    return Y[a]<Y[b];
}
bool cmpZ(int a, int b) {
    return Z[a]<Z[b];
}
int main(void) {
    scanf("%d", &N);
    for (int i=0;i<N;i++) {
        scanf("%d%d%d", &X[i], &Y[i], &Z[i]);
        SX[i] = SY[i] = SZ[i] = i;
    }
    sort(SX, SX+N, cmpX);
    sort(SY, SY+N, cmpY);
    sort(SZ, SZ+N, cmpZ);
    int curX = N-1;
    int curY = N-1;
    int curZ = N-1;
    while (curX >= 0 && curY >= 0 && curZ >= 0) {
        int x = SX[curX];
        int y = SY[curY];
        int z = SZ[curZ];
        if (X[y] >= X[x]) { curY--; continue; }
        if (X[z] >= X[x]) { curZ--; continue; }
        if (Y[x] >= Y[y]) { curX--; continue; }
        if (Y[z] >= Y[y]) { curZ--; continue; }
        if (Z[x] >= Z[z]) { curX--; continue; }
        if (Z[y] >= Z[z]) { curY--; continue; }
        printf("%d\n", X[x]+Y[y]+Z[z]);
        return 0;
    }
    printf("-1\n");
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

team.cpp: In function 'int main()':
team.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     scanf("%d", &N);
      |     ~~~~~^~~~~~~~~~
team.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         scanf("%d%d%d", &X[i], &Y[i], &Z[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...