Submission #1981154


Source Code Expand

// header {{{
#include <bits/stdc++.h>
using namespace std;

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(long long i=(l);i<(r);i++)
#define dec(i, l, r)   for(long long i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n, m;cin >> n >> m;
    cout << n*(n+1)*(2*n+1)/6%m << endl;
    return 0;
}

Submission Info

Submission Time
Task A - 団子とうさぎ
User monman53
Language C++14 (GCC 5.4.1)
Score 50
Code Size 740 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 50 / 50
Status
AC × 30
Set Name Test Cases
All case_000.txt, case_001.txt, case_002.txt, case_003.txt, case_004.txt, case_005.txt, case_006.txt, case_007.txt, case_008.txt, case_009.txt, case_010.txt, case_011.txt, case_012.txt, case_013.txt, case_014.txt, case_015.txt, case_016.txt, case_017.txt, case_018.txt, case_019.txt, case_020.txt, case_021.txt, case_022.txt, case_023.txt, case_024.txt, case_025.txt, case_026.txt, case_027.txt, case_028.txt, case_029.txt
Case Name Status Exec Time Memory
case_000.txt AC 1 ms 256 KB
case_001.txt AC 1 ms 256 KB
case_002.txt AC 1 ms 256 KB
case_003.txt AC 1 ms 256 KB
case_004.txt AC 1 ms 256 KB
case_005.txt AC 1 ms 256 KB
case_006.txt AC 1 ms 256 KB
case_007.txt AC 1 ms 256 KB
case_008.txt AC 1 ms 256 KB
case_009.txt AC 1 ms 256 KB
case_010.txt AC 1 ms 256 KB
case_011.txt AC 1 ms 256 KB
case_012.txt AC 1 ms 256 KB
case_013.txt AC 1 ms 256 KB
case_014.txt AC 1 ms 256 KB
case_015.txt AC 1 ms 256 KB
case_016.txt AC 1 ms 256 KB
case_017.txt AC 1 ms 256 KB
case_018.txt AC 1 ms 256 KB
case_019.txt AC 1 ms 256 KB
case_020.txt AC 1 ms 256 KB
case_021.txt AC 1 ms 256 KB
case_022.txt AC 1 ms 256 KB
case_023.txt AC 1 ms 256 KB
case_024.txt AC 1 ms 256 KB
case_025.txt AC 1 ms 256 KB
case_026.txt AC 1 ms 256 KB
case_027.txt AC 1 ms 256 KB
case_028.txt AC 1 ms 256 KB
case_029.txt AC 1 ms 256 KB