Submission #1198375

#TimeUsernameProblemLanguageResultExecution timeMemory
1198375grafffDetecting Molecules (IOI16_molecules)C++20
46 / 100
1095 ms2372 KiB
#ifdef molecules.h #include "molecules.h" #endif #include <bits/stdc++.h> using namespace std; vector <int> find_subset(int l, int u, vector <int> w){ int n = w.size(), res = 0; vector <int> dp(u + 1, -2); dp[0] = -1; bool flag = false; for(int i = 0; i < n; i++){ for(int j = u; j >= 0; j--){ if(j - w[i] < 0){ break; } if(dp[j - w[i]] > -2){ if(dp[j] == -2){ dp[j] = i; } if(j >= l){ res = j; flag = true; break; } } } if(flag){ break; } } vector <int> ans; int x = dp[res]; while(x >= 0){ ans.push_back(x); res -= w[x]; x = dp[res]; } return ans; }

Compilation message (stderr)

molecules.cpp:1:17: warning: extra tokens at end of #ifdef directive
    1 | #ifdef molecules.h
      |                 ^
molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...