답안 #97130

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97130 2019-02-14T03:31:22 Z ahgus89 Snowy Roads (JOI16_snowy) C++14
15 / 100
15 ms 1820 KB
#include "Anyalib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
static int getL;
static int sz;
void InitAnya(int N, int A[], int B[])
{
    int i, j;
    sz=N;
    return;
}

void Anya(int C[])
{
    int i;
    for(i = 0 ; i < sz-1 ; i++)
        Save(i, C[i]);
}
#include "Borislib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
vector<vector<int>> graph(505);
static int n;
static pii edge[505];
void InitBoris(int N, int A[], int B[])
{
    int i, j;
    n=N;
    for(i=0;i<n-1;i++)
    {
        graph[A[i]].emplace_back(B[i]);
        graph[B[i]].emplace_back(A[i]);
        edge[i].first=A[i];
        edge[i].second=B[i];
    }
}


int Boris(int c)
{
    bool vt[505];
    int i, j, dist[505][505];
    memset(vt, 0, n);
    for(i=0;i<n-1;i++)
        dist[edge[i].second][edge[i].first]=dist[edge[i].first][edge[i].second]=Ask(i);
    queue<pii> q;
    q.emplace(0, 0);
    while(!q.empty())
    {
        pii t=q.front();
        q.pop();
        int dis=t.first, idx=t.second;
        if(vt[idx]) continue;
        vt[idx]=1;
        if(idx==c)
        {
            //cout<<c<<' '<<dis<<'\n';
            return dis;
        }
        for(i=0;i<graph[idx].size();i++)
            if(!vt[graph[idx][i]]) q.emplace(dis+dist[idx][graph[idx][i]], graph[idx][i]);
    }
}

Compilation message

Anya.cpp: In function 'void InitAnya(int, int*, int*)':
Anya.cpp:10:9: warning: unused variable 'i' [-Wunused-variable]
     int i, j;
         ^
Anya.cpp:10:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
Anya.cpp: At global scope:
Anya.cpp:6:12: warning: 'getL' defined but not used [-Wunused-variable]
 static int getL;
            ^~~~

Boris.cpp: In function 'void InitBoris(int, int*, int*)':
Boris.cpp:11:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
Boris.cpp: In function 'int Boris(int)':
Boris.cpp:44:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(i=0;i<graph[idx].size();i++)
                 ~^~~~~~~~~~~~~~~~~~
Boris.cpp:26:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j, dist[505][505];
            ^
Boris.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1024 KB Output is correct
2 Correct 6 ms 912 KB Output is correct
3 Correct 7 ms 1104 KB Output is correct
4 Correct 10 ms 1076 KB Output is correct
5 Correct 13 ms 1336 KB Output is correct
6 Correct 10 ms 1436 KB Output is correct
7 Correct 11 ms 1336 KB Output is correct
8 Correct 11 ms 1328 KB Output is correct
9 Correct 12 ms 1280 KB Output is correct
10 Correct 11 ms 1212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 1468 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 1804 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 1820 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -