제출 #875706

#제출 시각아이디문제언어결과실행 시간메모리
875706nasir_bashirovDetecting Molecules (IOI16_molecules)C++11
69 / 100
25 ms4160 KiB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;

#define db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
    ios_base::sync_with_stdio(0);\
    cin.tie(0);\
    cout.tie(0)\

vi find_subset(int x, int y, vi w) {
    vi org = w;
    sort(all(w));
    int s = 0, l = 0;
    for(int i = 0; i < w.size(); i++){
        s += w[i];
        while(l < i and s > y){
            s -= w[l];
            l++;
        }
        if(s >= x and s <= y){
            vi res;
            map<int, int> cnt;
            for(int j = l; j <= i; j++) cnt[w[j]]++;
            for(int j = 0; j < w.size(); j++){
                if(cnt[org[j]]) res.push_back(j), cnt[org[j]]--;
            }
            return res;
        }
    } 
    vi res;
    return res;
}

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i = 0; i < w.size(); i++){
      |                    ~~^~~~~~~~~~
molecules.cpp:34:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |             for(int j = 0; j < w.size(); j++){
      |                            ~~^~~~~~~~~~
#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...