제출 #770422

#제출 시각아이디문제언어결과실행 시간메모리
770422AmylopectinFlights (JOI22_flights)C++17
21 / 100
290 ms2224 KiB
#include "Ali.h" #include <string> #include <vector> #include <stdio.h> using namespace std; const int mxn = 2e4 + 10; vector<int> pa[mxn] = {}; int dis[mxn] = {}; // char ans = {}; string ans; int re(int cn,int be) { int i,j,fn; for(i=0; i<pa[cn].size(); i++) { fn = pa[cn][i]; if(fn == be) { continue; } dis[fn] = dis[cn] + 1; re(fn,cn); } return 0; } void Init(int n, std::vector<int> uu, std::vector<int> vv) { int i,j,cn,cm,fn,fm; for(i=0; i<n; i++) { pa[i].clear(); } for(i=0; i<n-1; i++) { pa[uu[i]].push_back(vv[i]); pa[vv[i]].push_back(uu[i]); } for(i=0; i<n; i++) { SetID(i,i); } return ; } std::string SendA(std::string s) { int i,j,k,cn,cm,fn,fm; ans.clear(); cn = 0; cm = 0; for(i=0; i<10; i++) { cn += (s[i] - '0') * (1<<i); } for(i=10; i<20; i++) { cm += (s[i] - '0') * (1<<(i-10)); } for(i=0; i<10; i++) { dis[cn*10+i] = 0; re(cn*10+i,-1); for(j=0; j<10; j++) { for(k=0; k<14; k++) { if((1<<k) & dis[cm*10+j]) { ans.push_back('1'); // ans[i*14+j] = '1'; } else { ans.push_back('0'); // ans[i*14+j] = '0'; } } } } // cm *= 157; // for(i=0; i<157; i++) // { // for(j=0; j<14; j++) // { // if((1<<j) & dis[cm+i]) // { // ans.push_back('1'); // // ans[i*14+j] = '1'; // } // else // { // ans.push_back('0'); // // ans[i*14+j] = '0'; // } // } // } return ans; }
#include "Benjamin.h" #include <string> #include <vector> #include <stdio.h> using namespace std; // int const mxn = 2e4 + 10; int n,yy,xx; string so; // char s[mxn] = {}; std::string SendB(int nn, int x, int y) { int i,j,cn,cm; so.clear(); for(i=0; i<20; i++) { so.push_back('0'); } n = nn; yy = y; xx = x; cn = xx / 10; for(i=0; i<10; i++) { if((1<<i) & cn) { so[i] = '1'; } else { so[i] = '0'; } } cm = yy / 10; for(i=0; i<10; i++) { if((1<<i) & cm) { so[i+10] = '1'; } else { so[i+10] = '0'; } } return so; } int Answer(std::string t) { int i,j,cn,cm,su = 0; cn = xx % 10; cm = yy % 10; for(i=0; i<14; i++) { su += (1<<i) * (t[cn*140 + cm*14+i] - '0'); } return su; }

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

Ali.cpp: In function 'int re(int, int)':
Ali.cpp:14:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   for(i=0; i<pa[cn].size(); i++)
      |            ~^~~~~~~~~~~~~~
Ali.cpp:13:9: warning: unused variable 'j' [-Wunused-variable]
   13 |   int i,j,fn;
      |         ^
Ali.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>)':
Ali.cpp:29:9: warning: unused variable 'j' [-Wunused-variable]
   29 |   int i,j,cn,cm,fn,fm;
      |         ^
Ali.cpp:29:11: warning: unused variable 'cn' [-Wunused-variable]
   29 |   int i,j,cn,cm,fn,fm;
      |           ^~
Ali.cpp:29:14: warning: unused variable 'cm' [-Wunused-variable]
   29 |   int i,j,cn,cm,fn,fm;
      |              ^~
Ali.cpp:29:17: warning: unused variable 'fn' [-Wunused-variable]
   29 |   int i,j,cn,cm,fn,fm;
      |                 ^~
Ali.cpp:29:20: warning: unused variable 'fm' [-Wunused-variable]
   29 |   int i,j,cn,cm,fn,fm;
      |                    ^~
Ali.cpp: In function 'std::string SendA(std::string)':
Ali.cpp:48:19: warning: unused variable 'fn' [-Wunused-variable]
   48 |   int i,j,k,cn,cm,fn,fm;
      |                   ^~
Ali.cpp:48:22: warning: unused variable 'fm' [-Wunused-variable]
   48 |   int i,j,k,cn,cm,fn,fm;
      |                      ^~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~

Benjamin.cpp: In function 'std::string SendB(int, int, int)':
Benjamin.cpp:12:9: warning: unused variable 'j' [-Wunused-variable]
   12 |   int i,j,cn,cm;
      |         ^
Benjamin.cpp: In function 'int Answer(std::string)':
Benjamin.cpp:50:9: warning: unused variable 'j' [-Wunused-variable]
   50 |   int i,j,cn,cm,su = 0;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...