제출 #942242

#제출 시각아이디문제언어결과실행 시간메모리
942242Nika533Detecting Molecules (IOI16_molecules)C++14
9 / 100
1035 ms1012 KiB
#pragma GCC diagnostic warning "-std=c++11" #include <bits/stdc++.h> #include "molecules.h" #define pb push_back #define f first #define s second #define MOD 1000000007 #define flush fflush(stdout) #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(), (x).rend() #define pii pair<int,int> using namespace std; int n,T,k; int last[1005]; pii dp[1005]; vector<int> freq[10005]; vector<int> find_subset(int l, int u, vector<int> W) { n=W.size(); vector<int> w; w.pb(0); for (auto x:W) w.pb(x); for (int i=1; i<=n; i++) { for (int j=1000; j>=w[i]+1; j--) { if (last[j-w[i]]) { dp[j]={1,last[j-w[i]]}; last[j]=w[i]; } } dp[w[i]]={1,w[i]}; last[w[i]]=w[i]; } for (int i=1; i<=n; i++) freq[w[i]].clear(); for (int i=1; i<=n; i++) freq[w[i]].pb(i-1); vector<int> v; for (int sum=l; sum<=u; sum++) { if (dp[sum].f) { vector<int> ind(10005,0); int val=sum; while (val) { if (ind[dp[val].s]>=freq[dp[val].s].size()) { int XX=0; while (1) XX++; } v.pb(freq[dp[val].s][ind[dp[val].s]]); ind[dp[val].s]++; val-=dp[val].s; } return v; } } return v; }

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

molecules.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
    1 | #pragma GCC diagnostic warning "-std=c++11"
      |                                ^~~~~~~~~~~~
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:39:23: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     if (ind[dp[val].s]>=freq[dp[val].s].size()) {
#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...