Submission #1080547

# Submission time Handle Problem Language Result Execution time Memory
1080547 2024-08-29T10:51:51 Z alexander707070 Hexagonal Territory (APIO21_hexagon) C++14
9 / 100
1 ms 600 KB
#include<bits/stdc++.h>
#define MAXN 100007
#include "hexagon.h"

using namespace std;

const long long mod=1e9+7;

int n;

long long ff(long long x){
    long long a=x-1,b=x,c=x+1;

    if(a%3==0)a/=3;
    if(b%3==0)b/=3;
    if(c%3==0)c/=3;

    return (((a*b)%mod)*c)%mod;
}

long long ak,bk,d[MAXN],len[MAXN];

int draw_territory(int N,int A,int B,vector<int> D,vector<int> L){
    n=N; ak=A; bk=B;

    for(int i=1;i<=n;i++){
        d[i]=D[i-1]; len[i]=L[i-1];
    }

    if(n==3){
        return ((ak*(((len[1]+1)*(len[1]+2)/2)%mod) )%mod + (bk*ff(len[1]+1))%mod)%mod ;
    }
}

/*int main(){
    cout<<draw_territory(3,2,4,{0,0,0},{3,3,3})<<"\n";
}*/

Compilation message

hexagon.cpp: In function 'int draw_territory(int, int, int, std::vector<int>, std::vector<int>)':
hexagon.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 1 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -