Submission #972327

# Submission time Handle Problem Language Result Execution time Memory
972327 2024-04-30T10:54:51 Z Tanos Detecting Molecules (IOI16_molecules) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define x first
#define y second
#define all(x) x.begin(), x.end()
#define el "\n"
#define pb push_back
#define pp pop_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define ibase ios_base::sync_with_stdio(0), cin.tie(0);

const int N = 5e5 + 5, M = 1e3 + 5, pw = 31;
const ll MAX = 1e15, inf = 1e9 + 7;

vector <int> find_subset(int l, int u, vector <int> a) {
	int n = a.size();
	pair <int, int> p[n];
	for (int i = 0; i < n; i++) {
		p[i] = {a[i], i + 1};
	}
	sort(p, p + n);
	ll sum = 0, j = 0, last = 0;
	for (int i = 0; i < n; i++) {
		sum += p[i].x;
		last = i;
		if (sum >= l && sum <= u) {
			break;
		}
		else if (sum >= l) {
			int j = 0;
			while (sum > u)
				sum -= p[j++].x;
			break;
		}
	}
	vector <int> ans;
	for (int i = j; i <= last; i++)
		ans.pb(p[i].y);
	return ans;
}



//void solve() {
//	
//	
//}

//int main() {
//    ibase;
//    int T = 1;
////    cin >> T;
//    for (int test = 1; test <= T; ++test) {
////        cout << " " << test << ":" << el;
//        solve();
//        cout << el;
//    }
//}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB sum of weights should be in [302..304] but it is 352
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -