제출 #445567

#제출 시각아이디문제언어결과실행 시간메모리
445567hgmhcDetecting Molecules (IOI16_molecules)C++17
31 / 100
200 ms716 KiB
#include "molecules.h" #include <bits/stdc++.h> #define REP(i,a,b) for (auto i = (a); i <= (b); ++i) #define PER(i,a,b) for (auto i = (b); i >= (a); --i) #define ALL(x) (x).begin(), (x).end() using namespace std; using ii = pair<int,int>; const int N = 20'0000; bool dp[1003]; vector<int> v[1003]; vector<ii> mol; std::vector<int> find_subset(int l, int u, std::vector<int> W) { REP(i,0,size(W)-1) mol.push_back({W[i],i}); dp[0] = true; for (auto [w,i] : mol) { PER(x,0,1000) { if (x+w > 1000 || !dp[x]) continue; dp[x+w] = true; v[x+w].assign(ALL(v[x])); v[x+w].push_back(i); if (l <= x+w && x+w <= u) { sort(ALL(v[x+w])); return v[x+w]; } } } return std::vector<int>(0); }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:3:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define REP(i,a,b) for (auto i = (a); i <= (b); ++i)
      |                                         ^
molecules.cpp:14:5: note: in expansion of macro 'REP'
   14 |     REP(i,0,size(W)-1) mol.push_back({W[i],i});
      |     ^~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...