Submission #697119

#TimeUsernameProblemLanguageResultExecution timeMemory
697119_Knyaz_Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #define ff first #define sc second using namespace std; void in() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); } vector<int> find_subset(int l, int r, vector<int> w){ vector<pair<int, int>> vec; vector<int> zero; zero.push_back(0); int sz = w.size(), sum = w[0]; for(int i = 0; i < sz; i++) vec.push_back({w[i], i}); sort(vec.begin(), vec.end()); int L = 0, R = 1; while(R < sz){ if(sum <= r) sum += vec[R++].ff; if(sum > r) sum -= vec[L++].ff; if(l <= sum && sum <= r){ vector<int> ans; for(int i = L; i < R; i++) ans.push_back(vec[i].sc); return ans; } } return zero; }

Compilation message (stderr)

molecules.cpp: In function 'void in()':
molecules.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
molecules.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...