| Task: | Euclidean Geometry |
| Sender: | Puhi~ |
| Submission time: | 2018-05-26 15:28:04 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.10 s | details |
| #2 | WRONG ANSWER | 0.11 s | details |
| #3 | WRONG ANSWER | 0.07 s | details |
| #4 | WRONG ANSWER | 0.08 s | details |
| #5 | WRONG ANSWER | 0.11 s | details |
| #6 | WRONG ANSWER | 0.11 s | details |
| #7 | WRONG ANSWER | 0.10 s | details |
| #8 | WRONG ANSWER | 0.08 s | details |
Compiler report
input/code.cpp: In function 'void solvaa()':
input/code.cpp:72:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < normals.size(); i++) {
~~^~~~~~~~~~~~~~~~Code
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
bool image[100][100];
bool is_edge(int ox, int oy) {
if (!image[ox][oy]) {
return false;
}
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
if (!image[ox+x][oy+y]) { return true; }
}
}
return false;
}
float normal(int ox, int oy) {
float dx = 0;
float dy = 0;
for (int x = -3; x <= 3; x++) {
for (int y = -3; y <= 3; y++) {
if (x == 0 && y == 0) {continue;}
if (image[ox+x][oy+y]) {
float l = sqrt(x*x + y*y);
if (l > 3) { continue; }
float nx = x / l;
float ny = y / l;
dx += nx;
dy += ny;
}
}
}
//cout << dy << ' ' << dx << endl;
//cout << dy << ' ' << dx << ' ' << atan2(dy, dx) << endl;
return atan2(dy, dx);
}
void solvaa() {
for (int x = 0; x < 100; x++) {
for (int y = 0; y < 100; y++) {
char tmp;
cin >> tmp;
image[x][y] = ('1' == tmp);
}
}
vector<float> normals;
for (int x = 0; x < 100; x++) {
for (int y = 0; y < 100; y++) {
if (is_edge(x, y)) {
normals.push_back(normal(x,y));
}
}
}
int sivut = 0;
float pi = 3.141592;
for (float dir = -pi; dir < pi; dir += 0.25) {
int count = 0;
for (int i = 0; i < normals.size(); i++) {
if(abs(dir-normals[i]) < 0.25/2) { count++; }
}
if (count > 10) {
sivut++;
}
}
cout << sivut << endl;
}
int main() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
solvaa();
}
}
Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 100 000000000000000000000000000000... |
| correct output |
|---|
| 3 3 3 3 4 ... |
| user output |
|---|
| 5 4 3 4 8 ... Truncated |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 000000000000000000000000000000... |
| correct output |
|---|
| 3 4 4 4 3 ... |
| user output |
|---|
| 4 5 6 5 4 ... Truncated |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 100 000000000000000000000000000000... |
| correct output |
|---|
| 3 3 3 3 4 ... |
| user output |
|---|
| 4 5 4 4 7 ... Truncated |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 100 000000000000000000000000000000... |
| correct output |
|---|
| 3 3 3 4 3 ... |
| user output |
|---|
| 4 4 5 6 5 ... Truncated |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 100 000000000000000000000000000000... |
| correct output |
|---|
| 3 4 3 3 4 ... |
| user output |
|---|
| 5 6 2 6 7 ... Truncated |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 100 000000000000000000000000000000... |
| correct output |
|---|
| 4 3 4 4 4 ... |
| user output |
|---|
| 6 5 5 5 5 ... Truncated |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 100 000000000000000000000000000000... |
| correct output |
|---|
| 4 4 3 3 3 ... |
| user output |
|---|
| 8 6 6 5 5 ... Truncated |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 100 000000000000000000000000000000... |
| correct output |
|---|
| 3 3 3 3 3 ... |
| user output |
|---|
| 3 6 6 4 5 ... Truncated |
