Submission #464709

#TimeUsernameProblemLanguageResultExecution timeMemory
464709myvaluskaSticks (POI11_pat)C++14
100 / 100
255 ms21072 KiB
// palindromefree.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; //long long int cifra[20]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int k; cin >> k; vector<vector<int>>v(k); vector<pair<int, int>>vsetko; for(int farba=0;farba<k;farba++) { int n; cin >> n; for (int i = 0; i < n; i++) { int dlzka; cin >> dlzka; v[farba].push_back(dlzka); vsetko.push_back({ dlzka,farba }); } } sort(vsetko.begin(), vsetko.end()); for (int i = 0; i < k; i++) { vector<pair<int,int>>kan; for (int j = 0; j < vsetko.size(); j++) { if (vsetko[j].second == i) { if (kan.size() >= 2) { if (vsetko[j].first < kan[kan.size() - 1].first + kan[kan.size() - 2].first)//Platny trojuholnik!!!! { cout << vsetko[j].second+1 << ' '; cout << vsetko[j].first << ' '; cout << kan[kan.size() - 1].second+1 << ' '; cout << kan[kan.size() - 1].first << ' '; cout << kan[kan.size() - 2].second+1 << ' '; cout << kan[kan.size() - 2].first << endl; return 0; } } } else { if (kan.size() > 0) { while (kan[kan.size() - 1].second == vsetko[j].second&&kan.size()>0) { kan.pop_back(); //cout << kan.size() << endl; if (kan.size() == 0) { break; } } } kan.push_back({ vsetko[j].first,vsetko[j].second }); } } } cout << "NIE" << endl; return 0; //std::cout << "Hello World!\n"; } // Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Debug program: F5 or Debug > Start Debugging menu // Tips for Getting Started: // 1. Use the Solution Explorer window to add/manage files // 2. Use the Team Explorer window to connect to source control // 3. Use the Output window to see build output and other messages // 4. Use the Error List window to view errors // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file

Compilation message (stderr)

pat.cpp: In function 'int main()':
pat.cpp:35:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for (int j = 0; j < vsetko.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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...