답안 #81905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
81905 2018-10-27T16:42:45 Z duality Sailing Race (CEOI12_race) C++11
25 / 100
782 ms 4092 KB
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int adjMat[500][500];
int dp[500][500][2];
int main() {
    int i;
    int N,K,x;
    scanf("%d %d",&N,&K);
    for (i = 0; i < N; i++) {
        while (1) {
            scanf("%d",&x),x--;
            if (x == -1) break;
            else adjMat[i][x] = 1;
        }
    }

    if (K == 0) {
        int j,k,l;
        for (i = 2; i <= N; i++) {
            for (j = 0; j < N; j++) {
                k = (j+i-1) % N;
                for (l = (j+1) % N; l != k; l++,l %= N) {
                    if (adjMat[j][l]) dp[j][k][0] = max(dp[j][k][0],max(dp[j][l][1],dp[l][k][0])+1);
                    if (adjMat[k][l]) dp[j][k][1] = max(dp[j][k][1],max(dp[j][l][1],dp[l][k][0])+1);
                }
            }
        }
        int M = 0,p = -1;
        for (i = 0; i < N; i++) {
            for (j = 0; j < N; j++) {
                if ((i != j) && adjMat[i][j]) {
                    if ((dp[i][j][1] > M) || (dp[j][i][0] > M)) M = max(dp[i][j][1],dp[j][i][0])+1,p = i;
                }
            }
        }
        printf("%d\n%d\n",M,p+1);
    }

    return 0;
}

Compilation message

race.cpp: In function 'int main()':
race.cpp:63:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&N,&K);
     ~~~~~^~~~~~~~~~~~~~~
race.cpp:66:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&x),x--;
             ~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Incorrect 2 ms 380 KB Unexpected end of file - int32 expected
3 Incorrect 2 ms 404 KB Unexpected end of file - int32 expected
4 Incorrect 3 ms 556 KB Unexpected end of file - int32 expected
5 Correct 3 ms 752 KB Output is correct
6 Incorrect 3 ms 752 KB Unexpected end of file - int32 expected
7 Incorrect 7 ms 960 KB Output isn't correct
8 Incorrect 2 ms 960 KB Unexpected end of file - int32 expected
9 Correct 10 ms 1104 KB Output is correct
10 Correct 12 ms 1136 KB Output is correct
11 Correct 14 ms 1164 KB Output is correct
12 Incorrect 4 ms 1164 KB Unexpected end of file - int32 expected
13 Incorrect 3 ms 1220 KB Unexpected end of file - int32 expected
14 Incorrect 408 ms 3132 KB Output isn't correct
15 Incorrect 6 ms 3132 KB Unexpected end of file - int32 expected
16 Incorrect 7 ms 3132 KB Unexpected end of file - int32 expected
17 Incorrect 6 ms 3132 KB Unexpected end of file - int32 expected
18 Incorrect 782 ms 4092 KB Output isn't correct
19 Incorrect 9 ms 4092 KB Unexpected end of file - int32 expected
20 Incorrect 8 ms 4092 KB Unexpected end of file - int32 expected