답안 #864297

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864297 2023-10-22T10:54:13 Z vjudge1 Monster Game (JOI21_monster) C++17
0 / 100
91 ms 1616 KB
#include <bits/stdc++.h>
#include "monster.h"
using namespace std;

vector<int> Solve(int n)
{
    int wins[n]={0};
    bool outcome[n][n];
    vector<int> strength(n);
    for (int i=0; i<n; i++)
        for (int j=i+1; j<n; j++)
        {
            outcome[i][j]=Query(i, j);
            if (outcome[i][j]==true)
                wins[i]=wins[i]+1;
            else
                wins[j]=wins[j]+1;
        }
    for (int i=0; i<n; i++)
        strength[i]=wins[i];
    for (int i=0; i<n; i++)
        for (int j=j+1; j<n; j++)
        {
            if (wins[i]==n-2 && wins[j]==n-2)
            {
                strength[i]=n-1;
                strength[j]=n-2;
                if (outcome[i][j]==true)
                    swap(strength[i], strength[j]);

            }
            if (wins[i]==1 && wins[1]==1)
            {
                strength[i]=2;
                strength[j]=1;
                if (outcome[i][j]==true)
                    swap(strength[i], strength[j]);

            }
        }

    return strength;
}

Compilation message

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:22:18: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
   22 |         for (int j=j+1; j<n; j++)
      |                  ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 91 ms 1616 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -