QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#413944 | #412. Snowy Roads | zeta7532 | Compile Error | / | / | C++17 | 3.4kb | 2024-05-18 12:46:50 | 2024-05-18 12:46:51 |
Judging History
Anya
#include "snowy.h"
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
vector<int> bfsA(vector<vector<int>> G){
int N=G.size();
vector<int> dis(N,-1);
dis[0]=0;
queue<int> que;
que.push(0);
while(!que.empty()){
int v=que.front();
que.pop();
for(int nv:G[v]){
if(dis[nv]!=-1) continue;
dis[nv]=dis[v]+1;
que.push(nv);
}
}
return dis;
}
int NA;
vector<vector<int>> GA(550);
vector<int> disA;
vector<int> EA(550);
void InitAnya(int N , int A[] , int B[]) {
NA=N;
rep(i,N) GA[A[i]].push_back(B[i]);
rep(i,N) GA[B[i]].push_back(A[i]);
disA=bfsA(GA);
rep(i,N){
if(disA[A[i]]>disA[B[i]]) EA[A[i]]=i;
if(disA[B[i]]>disA[A[i]]) EA[B[i]]=i;
}
}
void Anya(int C[]) {
int N=NA;
vector<int> disnow(N,-1);
disnow[0]=0;
queue<int> que;
que.push(0);
while(!que.empty()){
int v=que.front();
que.pop();
for(int nv:GA[v]){
if(disnow[nv]!=-1) continue;
disnow[nv]=disnow[v]+C[EA[nv]];
que.push(nv);
}
}
vector<int> cnt(12,0);
rep(i,N) cnt[disA[i]%12]++;
int min_val=550,id_val=-1;
rep(i,12){
if(min_val>cnt[i]){
min_val=cnt[i];
id_val=i;
}
}
int now=0;
rep(i,N){
if(i==0||disA[i]%12==id_val){
int x=disnow[i];
rep(j,9){
Save(now,x%2);
x/=2;
now++;
}
}else{
Save(now,C[EA[i]]);
now++;
}
}
}
Boris
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
vector<int> bfsB(vector<vector<int>> G){
int N=G.size();
vector<int> dis(N,-1);
dis[0]=0;
queue<int> que;
que.push(0);
while(!que.empty()){
int v=que.front();
que.pop();
for(int nv:G[v]){
if(dis[nv]!=-1) continue;
dis[nv]=dis[v]+1;
que.push(nv);
}
}
return dis;
}
int NB;
vector<vector<int>> GB(550);
vector<int> disB;
vector<int> EB(550);
vector<int> par(550,-1);
void InitBoris(int N , int A[] , int B[]) {
NB=N;
rep(i,N) GB[A[i]].push_back(B[i]);
rep(i,N) GB[B[i]].push_back(A[i]);
disB=bfsB(GB);
rep(i,N){
if(disB[A[i]]>disB[B[i]]) EB[A[i]]=i,par[A[i]]=B[i];
if(disB[B[i]]>disB[A[i]]) EB[B[i]]=i,par[B[i]]=A[i];
}
}
int Boris(int city) {
int N=NB;
vector<int> cnt(12,0);
rep(i,N) cnt[disB[i]%12]++;
int min_val=550,id_val=-1;
rep(i,12){
if(min_val>cnt[i]){
min_val=cnt[i];
id_val=i;
}
}
vector<vector<int>> D(N);
int now=0;
rep(i,N){
if(i==0||disB[i]%12==id_val){
rep(j,9){
D[i].push_back(now);
now++;
}
}else{
D[i].push_back(now);
now++;
}
}
int ans=0;
int v=city;
while(1){
if(v==0||disB[v]%12==id_val){
int po=1;
rep(j,9){
ans+=Ask(D[v][j])*po;
po*=2;
}
break;
}else{
ans+=Ask(D[v][0]);
v=par[v];
}
}
return ans;
}
Details
Anya.code:1:10: fatal error: snowy.h: No such file or directory 1 | #include "snowy.h" | ^~~~~~~~~ compilation terminated. grader_Anya.cpp: In function ‘int main(int, char**)’: grader_Anya.cpp:54:13: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 54 | char *t = "/dev/null"; | ^~~~~~~~~~~ grader_Anya.cpp:110:14: warning: zero-length gnu_printf format string [-Wformat-zero-length] 110 | quitf(_ok, ""); | ^~