Submission #729046

# Submission time Handle Problem Language Result Execution time Memory
729046 2023-04-23T12:45:36 Z Nahian9696 Hexagonal Territory (APIO21_hexagon) C++17
0 / 100
1 ms 324 KB
#include "hexagon.h"

#include <vector>
#include <bits/stdc++.h>

using namespace std;

#define f0(i, n)                for(int i = 0; i <  (n); i++)
#define f1(i, n)                for(int i = 1; i <= (n); i++)
#define pb                      push_back
#define ff first
#define ss second


pair<long double, long double> dir[] = {
    {0, 2},
    {sqrt(3), 1},
    {sqrt(3), -1},
    {-0, -2},
    {-sqrt(3), -1},
    {-sqrt(3), 1}
};


int draw_territory(int N, int A, int B,
                   std::vector<int> D, std::vector<int> L) {
    if(B == 0) {
        vector<pair<long double, long double>> coord;
        coord.pb({0, 0});
        pair<long double, long double> cur = {0, 0};
        int len = 0;
        f0(i, N) {
            cur.ff = cur.ff + L[i]*dir[D[i]].ff;
            cur.ss = cur.ss + L[i]*dir[D[i]].ss;
            coord.pb(cur);
            len += L[i];
        }

        long double area = 0;
        f0(i, N) {
            area += coord[i].ff*coord[i+1].ss;
            area -= coord[i].ss*coord[i+1].ff;
        }

        area = abs(area)/2;
        cout << area << endl;

        area += (6/sqrt(3));

        area -= (len*3.0/sqrt(3));

        area /= (6/sqrt(3));
        cout << area << endl;

        return floor(area + 0.5);

    }

    if(N == 3) {

    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -