이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int N;
vector<pair<int, int> > g[2048];
int dist[2048];
vector<bool> cur;
bool processed[2048];
void computeShortestPath(){
memset(dist, 0x3F, sizeof(dist));
dist[0] = 0;
memset(processed, 0, sizeof(processed));
for(int i = 0; i < N; i++){
int mn = 1e9;
int u = -1;
for(int j = 0; j < N; j++){
if(dist[j] < mn && !processed[j]){
mn = dist[j];
u = j;
}
}
if(u == -1) break;
processed[u] = true;
for(auto v : g[u]){
if(dist[v.first] > dist[u] + v.second){
dist[v.first] = dist[u] + v.second;
}
}
}
}
}
void InitA(int N, int A, vector<int> U, vector<int> V,
vector<int> C) {
::N = N;
for(int i = 0; i < A; i++){
g[U[i]].emplace_back(V[i], C[i]);
g[V[i]].emplace_back(U[i], C[i]);
}
}
void ReceiveA(bool x) {
cur.push_back(x);
if(cur.size() % 31 == 0){
int w = 0;
for(int i = cur.size()-31; i < cur.size()-22; i++){
if(cur[i]) w += 1 << (i-cur.size()+31);
}
int u = 0;
for(int i = cur.size()-22; i < cur.size()-11; i++){
if(cur[i]) u += 1 << (i-cur.size()+22);
}
int v = 0;
for(int i = cur.size()-11; i < cur.size(); i++){
if(cur[i]) v += 1 << (i-cur.size()+11);
}
g[u].emplace_back(v,w);
g[v].emplace_back(u,w);
}
computeShortestPath();
}
vector<int> Answer() {
vector<int> ans;
for(int i = 0; i < N; i++){
ans.push_back(dist[i]);
}
return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int N;
}
void InitB(int N, int B, std::vector<int> S, std::vector<int> T,
std::vector<int> D) {
::N = N;
for(int i = 0; i < B; i++){
for(int j = 0; j < 9; j++){
if(D[i] & (1 << j)) SendB(true);
else SendB(false);
}
for(int j = 0; j < 11; j++){
if(S[i] & (1 << j)) SendB(true);
else SendB(false);
}
for(int j = 0; j < 11; j++){
if(T[i] & (1 << j)) SendB(true);
else SendB(false);
}
}
}
void ReceiveB(bool y) {
}
/*
4 3 4
0 1 6
2 1 4
2 0 10
1 2 3
3 1 1
3 2 3
3 0 7
*/
컴파일 시 표준 에러 (stderr) 메시지
Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:48:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = cur.size()-31; i < cur.size()-22; i++){
~~^~~~~~~~~~~~~~~
Azer.cpp:52:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = cur.size()-22; i < cur.size()-11; i++){
~~^~~~~~~~~~~~~~~
Azer.cpp:56:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = cur.size()-11; i < cur.size(); i++){
~~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |