Submission #1152709

#TimeUsernameProblemLanguageResultExecution timeMemory
1152709at128Detecting Molecules (IOI16_molecules)C++20
0 / 100
0 ms324 KiB
#include "molecules.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #ifndef ONLINE_JUDGE #define debug(x...) cerr << "[" << #x << "] = ["; _print(x) #else #define debug(x...) #endif typedef tree< int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset; #define all(v) ((v).begin()), ((v).end()) #define sz(v) ((int)((v).size())) #define pb push_back typedef long long ll; int n,l,r; vector<int>res,t,v; std::vector<int> find_subset(int l1, int u, std::vector<int> w) { n=w.size(); l=l1; r=u; v=w; sort(all(v)); if(l==0){ return res; } int i=0,j=0; ll sum=0; while(j<n){ if(i==j){ sum+=v[j++]; }else if(sum<l){ sum+=v[j++]; }else if(sum>r){ sum-=v[i++]; }else{ break; } } if(sum>=l and sum<=r){ for(int k=i;k<=j;k++){ res.pb(v[k]); } } return res; }

Compilation message (stderr)

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...