# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
248859 |
2020-07-13T15:03:21 Z |
vanic |
Pick (COI18_pick) |
C++14 |
|
1 ms |
512 KB |
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <assert.h>
using namespace std;
int a, b, c, d;
vector < pair < int, int > > sol;
int xs, ys;
void push(){
sol.push_back({xs, ys});
}
void slucaj5(){
for(int i=0; i<c/2; i++){
push();
xs++;
ys++;
}
push();
xs--;
ys++;
for(int i=0; i<c/2-1; i++){
push();
xs--;
ys--;
}
for(int i=0; i<d/2-1; i++){
push();
xs--;
ys++;
}
push();
xs--;
ys--;
for(int i=0; i<d/2; i++){
push();
xs++;
ys--;
}
assert(xs==0 && ys==0);
}
void slucaj1(){
if(a && b){
for(int i=0; i<a/2; i++){
push();
xs++;
}
for(int i=0; i<c/2; i++){
push();
xs++;
ys++;
}
push();
ys++;
for(int i=0; i<c/2; i++){
push();
xs--;
ys--;
}
for(int i=0; i<a/2-1; i++){
push();
xs--;
}
for(int i=0; i<b/2-1; i++){
push();
ys++;
}
for(int i=0; i<d/2; i++){
push();
xs--;
ys++;
}
push();
xs--;
for(int i=0; i<d/2; i++){
push();
xs++;
ys--;
}
for(int i=0; i<b/2; i++){
push();
ys--;
}
}
else if(!a){
for(int i=0; i<b/2; i++){
push();
ys++;
}
if(c){
for(int i=0; i<c/2; i++){
push();
xs++;
ys++;
}
for(int i=0; i<d/2; i++){
push();
xs++;
ys--;
}
push();
ys--;
for(int i=0; i<d/2; i++){
push();
xs--;
ys++;
}
for(int i=0; i<c/2-1; i++){
push();
xs--;
ys--;
}
for(int i=0; i<b/2-1; i++){
push();
ys--;
}
push();
xs--;
ys--;
}
else{
for(int i=0; i<d/2; i++){
push();
xs++;
ys--;
}
push();
ys--;
for(int i=0; i<d/2-1; i++){
push();
xs--;
ys++;
}
for(int i=0; i<b/2-1; i++){
push();
ys--;
}
push();
xs--;
ys++;
}
}
else{
for(int i=0; i<a/2; i++){
push();
xs++;
}
if(c){
for(int i=0; i<c/2; i++){
push();
xs++;
ys++;
}
for(int i=0; i<d/2; i++){
push();
xs--;
ys++;
}
push();
xs--;
for(int i=0; i<d/2; i++){
push();
xs++;
ys--;
}
for(int i=0; i<c/2-1; i++){
push();
xs--;
ys--;
}
for(int i=0; i<a/2-1; i++){
push();
xs--;
}
push();
xs--;
ys--;
}
else{
for(int i=0; i<d/2; i++){
push();
xs--;
ys++;
}
push();
xs--;
for(int i=0; i<d/2-1; i++){
push();
xs++;
ys--;
}
for(int i=0; i<a/2-1; i++){
push();
xs--;
}
push();
xs++;
ys--;
}
}
assert(xs==0 && ys==0);
}
void slucaj2(){
push();
if(a){
xs++;
ys++;
for(int i=0; i<a/2-1; i++){
push();
xs++;
}
push();
xs++;
ys--;
for(int i=0; i<a/2-1; i++){
push();
xs--;
}
for(int i=0; i<b/2; i++){
push();
ys--;
}
for(int i=0; i<d/2; i++){
push();
xs++;
ys--;
}
push();
xs--;
for(int i=0; i<d/2; i++){
push();
xs--;
ys++;
}
for(int i=0; i<b/2; i++){
push();
ys++;
}
for(int i=0; i<c/2; i++){
push();
xs--;
ys--;
}
push();
xs--;
for(int i=0; i<c/2; i++){
push();
xs++;
ys++;
}
}
else{
xs--;
ys++;
for(int i=0; i<b/2-1; i++){
push();
ys++;
}
push();
xs++;
ys++;
for(int i=0; i<b/2-1; i++){
push();
ys--;
}
for(int i=0; i<c/2; i++){
push();
xs++;
ys++;
}
push();
ys--;
for(int i=0; i<d/2; i++){
push();
xs--;
ys--;
}
for(int i=0; i<c/2; i++){
push();
xs++;
ys--;
}
push();
ys--;
for(int i=0; i<c/2; i++){
push();
xs--;
ys++;
}
}
assert(xs==0 && ys==0);
}
void slucaj3(){
for(int i=0; i<a/2; i++){
push();
xs--;
}
for(int i=0; i<d/2; i++){
push();
xs--;
ys++;
}
push();
ys++;
for(int i=0; i<d/2; i++){
push();
xs++;
ys--;
}
for(int i=0; i<a/2; i++){
push();
xs++;
}
push();
xs++;
ys--;
for(int i=0; i<b/2; i++){
push();
ys--;
}
for(int i=0; i<c/2; i++){
push();
xs--;
ys--;
}
push();
xs--;
for(int i=0; i<c/2; i++){
push();
xs++;
ys++;
}
for(int i=0; i<b/2; i++){
push();
ys++;
}
assert(xs==0 && ys==0);
}
void slucaj4(){
for(int i=0; i<a/2; i++){
push();
xs++;
}
for(int i=0; i<d/2; i++){
push();
xs++;
ys++;
}
push();
ys++;
for(int i=0; i<d/2; i++){
push();
xs--;
ys--;
}
for(int i=0; i<a/2; i++){
push();
xs--;
}
push();
xs--;
ys--;
for(int i=0; i<b/2; i++){
push();
ys--;
}
for(int i=0; i<c/2; i++){
push();
xs++;
ys--;
}
push();
xs++;
for(int i=0; i<c/2; i++){
push();
xs--;
ys++;
}
for(int i=0; i<b/2; i++){
push();
ys++;
}
assert(xs==0 && ys==0);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b >> c >> d;
if(a==0 && b==0){
slucaj5();
}
else if(a%2==0 && b%2==0 && c%2==0 && d%2==0){
slucaj1();
}
else if(a%2==0 && b%2==0 && c%2 && d%2){
slucaj2();
}
else if(a%2 && b%2 && d%2){
slucaj3();
}
else{
slucaj4();
}
for(int i=0; i<sol.size(); i++){
cout << sol[i].first << " " << sol[i].second << '\n';
}
return 0;
}
Compilation message
pick.cpp: In function 'int main()':
pick.cpp:419:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<sol.size(); i++){
~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Halted |
0 ms |
0 KB |
- |