제출 #1043671

#제출 시각아이디문제언어결과실행 시간메모리
1043671pravcoder게임 (IOI14_game)C++17
0 / 100
1 ms348 KiB
#include "game.h" #include <vector> #include <cmath> #include <iostream> #include <cstdio> #include <algorithm> using namespace std; typedef long long ll; typedef short int si; typedef vector<int> vi; typedef vector<vi> v2i; typedef vector<v2i> v3i; typedef vector<si> vs; typedef vector<vs> v2s; typedef vector<v2s> v3s; #define pb push_back #define rep(i, n) for (int i=0; i<n; i++) int i = 0; int r = 0; int N = 0; v2s trinum, upt, ept; v3s cid; v3i re; void initialize(int n) { N = n; r = n*(n-1) / 2; re.resize(7); cid.resize(7); trinum.resize(7); upt.resize(7); ept.resize(7); int s; // setting up trinum, cid rep(c, n) { s = 1; rep(j, 7) { s*=3; int tnum = floor(c/s); trinum[j].pb(tnum); cid[j].resize(tnum + 1); cid[j][tnum].pb(c); } } // setting up ept, upt s = 1; rep(j, 7) { s *= 3; upt[j].resize(cid[j].size(), 0); int ptr = 0; while (ptr < n) { ept[j].pb(min(s, n - ptr)); ptr += s; } } //setting up re rep(j, 7) { rep(k, cid[j].size()) { if (j == 0) { if (ept[j][k] == 3) re[j][k].resize(3, 1); else re[j][k].resize(ept[j][k]-1, 1); } else { if (ept[j][k] == 3) { re[j][k].pb(cid[j-1][3*k].size()*cid[j-1][3*k + 1].size()); re[j][k].pb(cid[j-1][3*k + 1].size()*cid[j-1][3*k + 2].size()); re[j][k].pb(cid[j-1][3*k + 2].size()*cid[j-1][3*k].size()); } else if (ept[j][k] == 2) { re[j][k].pb(cid[j-1][3*k].size()*cid[j-1][3*k + 1].size()); } } } } } int hasEdge(int u, int v) { i++; if (v<u) swap(u,v); int l = 0; // lvl of the original triangle while (trinum[l][u] != trinum[l][v]) l++; int t = trinum[l][u]; if (l == 0) { return ++upt[l][t] > 1; } else { int tu = trinum[l-1][u]; int tv = trinum[l-1][v]; int renum = (1 - (tu + tv - 6*t)) % 3; if (--re[l][t][renum] == 0) { return ++upt[l][t] > 1; } else return 0; } }

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

game.cpp: In function 'void initialize(int)':
game.cpp:20:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<short int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define rep(i, n) for (int i=0; i<n; i++)
......
   63 |         rep(k, cid[j].size()) {
      |             ~~~~~~~~~~~~~~~~      
game.cpp:63:9: note: in expansion of macro 'rep'
   63 |         rep(k, cid[j].size()) {
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...