This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int a, b, c, d;
bool ab, cd;
string s;
vector < pair <int, int> > v;
void obradi () {
int cx = 0, cy = 0;
int len = s.size();
for (int i=0; i<len; i++) {
v.push_back(make_pair(cx, cy));
if (s[i] == 'a') cx++; else if (s[i] == 'A') cx--;
if (s[i] == 'b') cy++; else if (s[i] == 'B') cy--;
if (s[i] == 'c') {cx++; cy++;} else if (s[i] == 'C') {cx--; cy--;}
if (s[i] == 'd') {cx--; cy++;} else if (s[i] == 'D') {cx++; cy--;}
}
}
void ispis () {
if (ab) {
for (int i=0; i<v.size(); i++) {
swap(v[i].first, v[i].second);
}
}
if (cd) {
for (int i=0; i<v.size(); i++) {
v[i].second = -v[i].second;
}
}
for (int i=0; i<v.size(); i++) {
cout << v[i].first << " " << v[i].second << endl;
}
}
int main () {
cin >> a >> b >> c >> d;
if (c == 0 && d == 0) {
for (int i=0; i<a/2; i++) s += 'a';
s += 'b';
for (int i=0; i<a/2-1; i++) s += 'A';
for (int i=0; i<b/2-1; i++) s += 'b';
s += 'A';
for (int i=0; i<b/2; i++) s += 'B';
} else if (a == 0 && b == 0) {
for (int i=0; i<c/2; i++) s += 'c';
s += 'd';
for (int i=0; i<c/2-1; i++) s += 'C';
for (int i=0; i<d/2-1; i++) s += 'd';
s += 'C';
for (int i=0; i<d/2; i++) s += 'D';
} else {
if (a == 0) {
swap(a, b);
ab = 1;
}
if (c%2 == 0) {
swap(c, d);
cd = 1;
}
if (a%2 == 0 && b%2 == 0 && c%2 == 0 && d%2 == 0) {
for (int i=0; i<a/2; i++) s += 'a';
s += 'c';
for (int i=0; i<b/2; i++) s += 'b';
for (int i=0; i<c/2-1; i++) s += 'c';
for (int i=0; i<d/2; i++) s += 'd';
s += 'A';
for (int i=0; i<d/2; i++) s += 'D';
for (int i=0; i<c/2-1; i++) s += 'C';
for (int i=0; i<b/2; i++) s += 'B';
for (int i=0; i<a/2-1; i++) s += 'A';
s += 'C';
} else if (a%2 == 0 && b%2 == 0 && c%2 == 1 && d%2 == 1) {
for (int i=0; i<(a-2)/2; i++) s += 'a';
s += 'c';
for (int i=0; i<b/2; i++) s += 'b';
for (int i=0; i<(c-1)/2; i++) s += 'c';
for (int i=0; i<(d-1)/2; i++) s += 'd';
s += 'A';
for (int i=0; i<(d-1)/2; i++) s += 'D';
for (int i=0; i<(c-1)/2; i++) s += 'C';
for (int i=0; i<b/2; i++) s += 'B';
for (int i=0; i<(a-2)/2; i++) s += 'A';
s += 'A';
s += 'D';
} else if (a%2 == 1 && b%2 == 1 && c%2 == 1 && d%2 == 0) {
for (int i=0; i<(a-1)/2; i++) s += 'a';
s += 'c';
for (int i=0; i<(b-1)/2; i++) s += 'b';
for (int i=0; i<(c-1)/2; i++) s += 'c';
for (int i=0; i<d/2; i++) s += 'd';
s += 'A';
for (int i=0; i<d/2; i++) s += 'D';
for (int i=0; i<(c-1)/2; i++) s += 'C';
for (int i=0; i<(b-1)/2; i++) s += 'B';
for (int i=0; i<(a-1)/2; i++) s += 'A';
s += 'B';
}
}
obradi();
ispis();
return 0;
}
Compilation message (stderr)
pick.cpp: In function 'void ispis()':
pick.cpp:24:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i<v.size(); i++) {
~^~~~~~~~~
pick.cpp:29:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i<v.size(); i++) {
~^~~~~~~~~
pick.cpp:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i<v.size(); i++) {
~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |