제출 #539418

#제출 시각아이디문제언어결과실행 시간메모리
539418dooweySpeedrun (RMI21_speedrun)C++14
100 / 100
174 ms1104 KiB
#include <bits/stdc++.h> #include "speedrun.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair const int N = 1010; vector<int> T[N]; vector<int> bits(int u){ vector<int> sol; for(int i = 0 ; i < 10; i ++ ){ if((u & (1 << i))){ sol.push_back(1); } else{ sol.push_back(0); } } return sol; } vector<int> ord; vector<int> A[N]; vector<int> B[N]; void dfs(int u, int p){ A[u] = bits(p); B[u] = bits(0); ord.push_back(u); for(auto x : T[u]){ if(x == p) continue; dfs(x, u); } } void assignHints(int subtask, int n, int AA[], int BB[]) { /* your solution here */ for(int i = 1; i <= n-1; i ++ ){ T[AA[i]].push_back(BB[i]); T[BB[i]].push_back(AA[i]); } dfs(1,-1); for(int i = 0 ; i + 1 < ord.size(); i ++ ){ B[ord[i]] = bits(ord[i + 1]); } setHintLen(20); for(int i = 1; i <= n; i ++ ){ for(int j = 0 ; j < A[i].size(); j ++ ){ setHint(i, j + 1, A[i][j]); } for(int j = 0 ; j < B[i].size(); j ++ ){ setHint(i, j + 11, B[i][j]); } } } int parent(){ int x; int res = 0; for(int j = 0 ; j < 10 ; j ++ ){ x = getHint(j + 1); res += x * 1ll * (1 << j); } return res; } int next(){ int x; int res = 0; for(int j = 0 ; j < 10 ; j ++ ){ x = getHint(j + 11); res += x * 1ll * (1 << j); } return res; } void speedrun(int subtask, int n, int start) { /* your solution here */ int v; while(start != 1){ v = parent(); goTo(v); start = v; } int q; while(1){ v = next(); if(v == 0) break; while(goTo(v) == false){ q = parent(); start = q; goTo(q); } start = v; } }

컴파일 시 표준 에러 (stderr) 메시지

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:49:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     for(int i = 0 ; i + 1 < ord.size(); i ++ ){
      |                     ~~~~~~^~~~~~~~~~~~
speedrun.cpp:54:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         for(int j = 0 ; j < A[i].size(); j ++ ){
      |                         ~~^~~~~~~~~~~~~
speedrun.cpp:57:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |         for(int j = 0 ; j < B[i].size(); j ++ ){
      |                         ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...