제출 #297938

#제출 시각아이디문제언어결과실행 시간메모리
297938dandrozavrDetecting Molecules (IOI16_molecules)C++14
100 / 100
68 ms6252 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ld long double
#define fi first
#define se second
#define F first
#define S second
#define pii pair < int , int >
#define _ <<" "<<
#define TIME 1.0 * clock() / CLOCKS_PER_SEC

#include "molecules.h"

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    vector < int > nul;
    ll sum = 0;
    int now = 0;
    int n = w.size();
    vector < pii > a;
    for (int i = 0; i < w.size(); ++i)
        a.pb({w[i], i});
    sort(a.begin(), a.end());
    for (int i = 0; i < n; ++i){
        sum += a[i].F;
        while(sum > u) sum -= a[now++].F;
        if (sum >= l){
            for (; now <= i; ++now)
                nul.pb(a[now].S);
            return nul;
        }
    }
    return nul;
}

컴파일 시 표준 에러 (stderr) 메시지

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)
      |                     ~~^~~~~~~~~~
#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...