Submission #674412

#TimeUsernameProblemLanguageResultExecution timeMemory
674412QwertyPiSubway (info1cup19_subway)C++14
100 / 100
60 ms1368 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int k; cin >> k; int ans = 0; vector<pair<int, int>> vp = {{0, -1}}; while(ans + vp.size() <= k){ ans += vp.size(); vp.push_back({vp.size(), vp.size() - 1}); } if(ans != k) vp.push_back({vp.size(), k - ans - 1}); cout << vp.size() << endl; for(auto i : vp){ cout << i.first << ' ' << i.second << endl; } }

Compilation message (stderr)

subway.cpp: In function 'int main()':
subway.cpp:9:24: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    9 |  while(ans + vp.size() <= k){
      |        ~~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...