제출 #492193

#제출 시각아이디문제언어결과실행 시간메모리
492193Tox123Cutting a rectangle (LMIO18_staciakampis)C++11
0 / 100
1 ms204 KiB
#include <iostream> #include <bits/stdc++.h> #include <utility> using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> PossibleR; for(int i = 0;i<n;i++){ int a, b; cin >> a >> b; int CurrentPossibleRSize = PossibleR.size(); if(CurrentPossibleRSize==0){ PossibleR.push_back(make_pair(a,b)); }else{ for(int x = 0;x < CurrentPossibleRSize;x++){ vector<pair<int, int>> OtherPossibleR; //int a1 = PossibleR.at(x).first;int b1 = PossibleR.at(x).second; if(PossibleR.at(x).first==a){ OtherPossibleR.push_back(make_pair(a,PossibleR.at(x).second+b)); } if(PossibleR.at(x).second==a){ OtherPossibleR.push_back(make_pair(PossibleR.at(x).first+b,a)); } if(PossibleR.at(x).first==b){ OtherPossibleR.push_back(make_pair(b,PossibleR.at(x).second+a)); } if(PossibleR.at(x).second==b){ OtherPossibleR.push_back(make_pair(PossibleR.at(x).first+a,b)); } bool AlreadyHadValue = false; for(int z = 0;z<OtherPossibleR.size();z++){ if(AlreadyHadValue==false){ PossibleR.at(x) = OtherPossibleR.at(z); }else{ PossibleR.push_back(OtherPossibleR.at(z)); } AlreadyHadValue = true; } } } } cout << PossibleR.size() << endl; list<int> Output; for(int i =0;i<PossibleR.size();i++){ Output.push_front(min(PossibleR.at(i).first,PossibleR.at(i).second)); } Output.sort(); for(int i : Output){cout << i << endl;}; return 0; }

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

staciakampis.cpp: In function 'int main()':
staciakampis.cpp:33:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |                 for(int z = 0;z<OtherPossibleR.size();z++){
      |                               ~^~~~~~~~~~~~~~~~~~~~~~
staciakampis.cpp:46:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for(int i =0;i<PossibleR.size();i++){
      |                  ~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...