Task: | Euclidean Geometry |
Sender: | Karhukopla |
Submission time: | 2018-05-26 15:59:05 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.11 s | details |
#2 | WRONG ANSWER | 0.12 s | details |
#3 | WRONG ANSWER | 0.13 s | details |
#4 | WRONG ANSWER | 0.13 s | details |
#5 | WRONG ANSWER | 0.10 s | details |
#6 | WRONG ANSWER | 0.14 s | details |
#7 | WRONG ANSWER | 0.10 s | details |
#8 | WRONG ANSWER | 0.13 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:3:11: warning: narrowing conversion of 'p.std::pair<int, int>::first' from 'int' to 'double' inside { } [-Wnarrowing] #define F first ^ input/code.cpp:22:24: note: in expansion of macro 'F' stack.push_back({p.F, p.S}); ^ input/code.cpp:4:11: warning: narrowing conversion of 'p.std::pair<int, int>::second' from 'int' to 'double' inside { } [-Wnarrowing] #define S second ^ input/code.cpp:22:29: note: in expansion of macro 'S' stack.push_back({p.F, p.S}); ^
Code
#include <bits/stdc++.h> using namespace std; #define F first #define S second int main() { int t; cin >> t; for (int ti = 0; ti < t; ++ti) { vector<pair<int, int>> ones; for (int i = 0; i < 100; ++i) { cin >> ws; for (int j = 0; j < 100; ++j) { char c; cin >> c; if (c == '1') ones.push_back({i, j}); } } vector<complex<double>> stacks[2]; for (int dir = 0; dir < 2; ++dir) { auto &stack = stacks[dir]; for (auto p : ones) { stack.push_back({p.F, p.S}); while (stack.size() >= 3) { bool drop = false; auto a = stack[stack.size()-3], b = stack[stack.size()-2], c = stack[stack.size()-1]; double ang = arg((c-b)/(b-a)); if (abs(ang) < M_PI/5) drop = true; else if (dir ? (ang < 0) : (ang > 0)) { drop = true; } if (drop) { stack.pop_back(); stack.pop_back(); stack.push_back(c); } else { break; } } } } reverse(stacks[1].begin(), stacks[1].end()); vector<complex<double>> fin; for (int dir = 0; dir < 2; ++dir) { for (auto c : stacks[dir]) { fin.push_back(c); while (fin.size() >= 2) { auto a = fin[fin.size()-2], b = fin[fin.size()-1]; if (abs(a-b) <= 15) { fin.pop_back(); fin.pop_back(); fin.push_back(b); } else break; } } } if (abs(fin.front()-fin.back()) <= 15) { fin.pop_back(); } int res = fin.size(); if (res > 4) res = 4; if (res < 3) res = 3; cout << res << endl; } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
100 000000000000000000000000000000... |
correct output |
---|
3 3 3 3 4 ... |
user output |
---|
3 3 3 3 4 ... Truncated |
Test 2
Verdict: WRONG ANSWER
input |
---|
100 000000000000000000000000000000... |
correct output |
---|
3 4 4 4 3 ... |
user output |
---|
3 4 4 4 3 ... Truncated |
Test 3
Verdict: WRONG ANSWER
input |
---|
100 000000000000000000000000000000... |
correct output |
---|
3 3 3 3 4 ... |
user output |
---|
3 3 3 4 4 ... Truncated |
Test 4
Verdict: WRONG ANSWER
input |
---|
100 000000000000000000000000000000... |
correct output |
---|
3 3 3 4 3 ... |
user output |
---|
3 3 3 4 3 ... Truncated |
Test 5
Verdict: WRONG ANSWER
input |
---|
100 000000000000000000000000000000... |
correct output |
---|
3 4 3 3 4 ... |
user output |
---|
4 4 3 3 4 ... Truncated |
Test 6
Verdict: WRONG ANSWER
input |
---|
100 000000000000000000000000000000... |
correct output |
---|
4 3 4 4 4 ... |
user output |
---|
4 3 4 4 4 ... Truncated |
Test 7
Verdict: WRONG ANSWER
input |
---|
100 000000000000000000000000000000... |
correct output |
---|
4 4 3 3 3 ... |
user output |
---|
4 4 3 3 3 ... Truncated |
Test 8
Verdict: WRONG ANSWER
input |
---|
100 000000000000000000000000000000... |
correct output |
---|
3 3 3 3 3 ... |
user output |
---|
3 3 3 4 3 ... Truncated |