답안 #982604

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
982604 2024-05-14T13:23:14 Z MarwenElarbi Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
//#include "molecules.h"
using namespace std;
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define ll long long
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
std::vector<int> find_subset(int l, int u, std::vector<int> w){
    vector<pair<int,int>> v;
    int n=w.size();
    for (int i = 0; i < n; ++i)
    {
        v.pb({w[i],i});
    }
    sort(v.begin(),v.end());
    ll sum=0;
    int j=0;
    vector<int> ans;
    for (int i = 0; i < w.size(); ++i)
    {
        sum+=v[i].fi;
        while(sum>u){
            sum-=v[j].fi;
            j++;
        }
        if(sum>=l){
            for (int k = 0; k < n; ++k)
            {
                ans.pb(v[i].se);
                break;
            }
        }
    }
    return ans;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:22:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for (int i = 0; i < w.size(); ++i)
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 1 ms 348 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB sum of weights should be in [302..304] but it is 153
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 1 ms 348 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 1 ms 348 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 1 ms 348 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 1 ms 348 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -