Submission #248840

#TimeUsernameProblemLanguageResultExecution timeMemory
248840vanicPick (COI18_pick)C++14
10 / 100
1 ms640 KiB
#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(){ 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--; } 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 (stderr)

pick.cpp: In function 'int main()':
pick.cpp:298:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<sol.size(); i++){
               ~^~~~~~~~~~~
#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...