Submission #954189

# Submission time Handle Problem Language Result Execution time Memory
954189 2024-03-27T11:27:57 Z Trisanu_Das Hexagonal Territory (APIO21_hexagon) C++17
30 / 100
31 ms 18140 KB
#include "hexagon.h"
 
#include <vector>
#include <iostream>
#include <cmath>
using namespace std;
long long int n,a,b,d[1000005],l[1000005],x[1000005],y[1000005];
int draw_territory(int N, int A, int B,std::vector<int> D, std::vector<int> L) {
	n=N;
	a=A;
	b=B;
	long long int p=0;
	for(int i=0;i<n;i++)
	{
		d[i]=D[i];
		l[i]=L[i];
		p+=l[i];
	}
	long long int nowx=0,nowy=0;
	long long int cnt=1;
	for(int i=0;i<n;i++)
	{
		if(d[i]==1)nowy+=l[i];
		if(d[i]==2)nowy+=l[i],nowx+=l[i];
		if(d[i]==3)nowx+=l[i];
		if(d[i]==4)nowy-=l[i];
		if(d[i]==5)nowy-=l[i],nowx-=l[i];
		if(d[i]==6)nowx-=l[i];
		x[cnt]=nowx;
		y[cnt]=nowy;
		cnt++;
	}
	long long int ans=0;
	for(int i=0;i<cnt;i++) ans+=x[i]*y[i+1]-y[i]*x[i+1];
	ans=abs(ans);
	long long int tmp=(ans-p+2)/2;
	tmp+=p;
	tmp%=1000000007;
	return tmp*a%1000000007;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4556 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Incorrect 1 ms 4444 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 2 ms 4640 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4552 KB Output is correct
5 Correct 1 ms 4700 KB Output is correct
6 Correct 2 ms 4700 KB Output is correct
7 Correct 6 ms 7512 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 7 ms 7880 KB Output is correct
12 Correct 7 ms 8028 KB Output is correct
13 Correct 7 ms 7920 KB Output is correct
14 Correct 8 ms 8028 KB Output is correct
15 Correct 1 ms 4440 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 3 ms 4704 KB Output is correct
5 Correct 1 ms 4448 KB Output is correct
6 Correct 1 ms 4452 KB Output is correct
7 Correct 2 ms 4712 KB Output is correct
8 Correct 3 ms 4712 KB Output is correct
9 Correct 5 ms 7520 KB Output is correct
10 Correct 1 ms 4448 KB Output is correct
11 Correct 1 ms 4548 KB Output is correct
12 Correct 1 ms 4456 KB Output is correct
13 Correct 8 ms 8040 KB Output is correct
14 Correct 7 ms 8028 KB Output is correct
15 Correct 7 ms 8036 KB Output is correct
16 Correct 8 ms 8228 KB Output is correct
17 Correct 1 ms 4440 KB Output is correct
18 Correct 1 ms 4440 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 13 ms 11048 KB Output is correct
21 Correct 2 ms 4952 KB Output is correct
22 Correct 1 ms 4700 KB Output is correct
23 Correct 17 ms 11612 KB Output is correct
24 Correct 26 ms 17232 KB Output is correct
25 Correct 27 ms 17504 KB Output is correct
26 Correct 14 ms 11356 KB Output is correct
27 Correct 12 ms 8544 KB Output is correct
28 Correct 7 ms 8028 KB Output is correct
29 Correct 31 ms 18140 KB Output is correct
30 Correct 29 ms 17752 KB Output is correct
31 Correct 29 ms 17752 KB Output is correct
32 Correct 28 ms 17508 KB Output is correct
33 Correct 14 ms 11648 KB Output is correct
34 Correct 7 ms 8036 KB Output is correct
35 Correct 1 ms 4552 KB Output is correct
36 Correct 1 ms 4444 KB Output is correct
37 Correct 1 ms 4448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4448 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4448 KB Output is correct
2 Correct 1 ms 4448 KB Output is correct
3 Incorrect 1 ms 4448 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4452 KB Output isn't correct
2 Halted 0 ms 0 KB -