Submission #674412

# Submission time Handle Problem Language Result Execution time Memory
674412 2022-12-24T05:05:23 Z QwertyPi Subway (info1cup19_subway) C++14
100 / 100
60 ms 1368 KB
#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

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 time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 13 ms 596 KB Output is correct
12 Correct 14 ms 596 KB Output is correct
13 Correct 13 ms 560 KB Output is correct
14 Correct 16 ms 592 KB Output is correct
15 Correct 13 ms 596 KB Output is correct
16 Correct 60 ms 1368 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 55 ms 1244 KB Output is correct
19 Correct 39 ms 960 KB Output is correct
20 Correct 40 ms 968 KB Output is correct