제출 #654825

#제출 시각아이디문제언어결과실행 시간메모리
654825sandry24Detecting Molecules (IOI16_molecules)C++17
10 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define pb push_back #define mp make_pair #define f first #define s second vi find_subset(int l, int u, vi w){ vector<pair<ll, ll>> a; for(int i = 0; i < w.size(); i++) a.pb(mp(w[i], i)); sort(a.begin(), a.end()); ll sum = 0, left = -1, right = -1; for(int i = 0; i < w.size(); i++){ if(sum + a[i].f <= u){ sum += a[i].f; right = i; left = 0; } else break; } if(l == -1) return {}; while(sum < l && right != w.size()-1){ sum -= a[left].f; sum += a[right+1].f; right++; left++; } if(sum < l) return {}; vi ans; for(int i = left; i <= right; i++) ans.pb(a[i].s); return ans; }

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

molecules.cpp: In function 'vi find_subset(int, int, vi)':
molecules.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i = 0; i < w.size(); i++)
      |                    ~~^~~~~~~~~~
molecules.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i = 0; i < w.size(); i++){
      |                    ~~^~~~~~~~~~
molecules.cpp:27:28: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     while(sum < l && right != w.size()-1){
      |                      ~~~~~~^~~~~~~~~~~~~
#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...