제출 #921955

#제출 시각아이디문제언어결과실행 시간메모리
921955HoriaHaivasDetecting Molecules (IOI16_molecules)C++14
31 / 100
2 ms772 KiB
/* "care a facut teste cu Lattice reduction attack e ciudat" "linistiti va putin" - 2023 - */ #include<bits/stdc++.h> #include<molecules.h> #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " #pragma GCC optimize("Ofast") using namespace std; vector<int> rez; struct sirelement { int val; int poz; }; vector<sirelement> v; bool cmp (sirelement a, sirelement b) { return a.val<b.val; } vector<int> find_subset(int l, int u, vector<int> w) { int i; for (i=0; i<w.size(); i++) { v.push_back({w[i],i}); } sort(v.begin(),v.end(),cmp); int pointer,s,j; s=0; pointer=0; for (i=0; i<v.size(); i++) { while (pointer<i) { s-=v[pointer].val; pointer++; } while (pointer<v.size() && s+v[pointer].val<=u) { s+=v[pointer].val; pointer++; } if (s>=l && s<=u) { for (j=i; j<pointer; j++) rez.push_back(v[j].poz); return rez; } else { s-=v[i].val; } } return rez; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:32:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for (i=0; i<w.size(); i++)
      |               ~^~~~~~~~~
molecules.cpp:40:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<sirelement>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for (i=0; i<v.size(); i++)
      |               ~^~~~~~~~~
molecules.cpp:47:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<sirelement>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         while (pointer<v.size() && s+v[pointer].val<=u)
      |                ~~~~~~~^~~~~~~~~
#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...