Submission #1370691

#TimeUsernameProblemLanguageResultExecution timeMemory
1370691n.bahizi_dylanDetecting Molecules (IOI16_molecules)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define v vector
#define pb push_back
v<int> find_subset(int l, int u, v<int> we) {
    int n = we.size();
    int l = 0;
    int r = n - 1;
    sort(we.begin(), we.end());
    while(l < r) {
        if(we[l] + w[r] <= u && we[l] + we[r] >= l) {
            retur{l, r};
        }
        else if(we[l] + w[r] > u) {
            r--;
        }
        else if(we[l] + w[r] < l) {
            l++;
        }
    }
    return {}
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:9: error: declaration of 'int l' shadows a parameter
    7 |     int l = 0;
      |         ^
molecules.cpp:5:24: note: 'int l' previously declared here
    5 | v<int> find_subset(int l, int u, v<int> we) {
      |                    ~~~~^
molecules.cpp:11:20: error: 'w' was not declared in this scope
   11 |         if(we[l] + w[r] <= u && we[l] + we[r] >= l) {
      |                    ^
molecules.cpp:12:13: error: 'retur' was not declared in this scope
   12 |             retur{l, r};
      |             ^~~~~
molecules.cpp:21:14: error: expected ';' before '}' token
   21 |     return {}
      |              ^
      |              ;
   22 | }
      | ~