QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#375030#3727. Nice Trickucup-team1251WA 68ms12872kbC++171.0kb2024-04-02 21:04:532024-04-02 21:04:54

Judging History

你现在查看的是最新测评结果

  • [2024-04-02 21:04:54]
  • 评测
  • 测评结果:WA
  • 用时:68ms
  • 内存:12872kb
  • [2024-04-02 21:04:53]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int N = 1e6 + 9;
const int mod = 1e9 + 7;
ll a[N];
ll s3[N], s2[N],s1[N];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    while(cin >> n)
    {
        for(int i = 1; i <= n; i ++)
        {
            cin >> a[i];
        }
        s1[n + 1] = s2[n + 1] = s2[n + 1] = 0;
        for(int i = n; i >= 1; i --)
        {
            s1[i] = (s1[i + 1] + a[i]) % mod;
            s2[i] = (s2[i + 1] + (a[i] * a[i]) % mod) % mod;
            s3[i] = (s3[i + 1] + (((a[i] * a[i]) % mod) * a[i]) % mod) % mod;
        } 
        ll ans = 0;
        for(int i = 1; i + 3 <= n; i ++)
        {
            ll n1 = ((s1[i + 1] * s1[i + 1]) % mod * s1[i + 1])% mod;
            ll n2 = ((3 * s2[i + 1]) % mod * s1[i + 1])%mod;
            ll n3 = (2 * s3[i + 1])%mod;
            ll n4 = ((n1 - n2 + n3) * 166666668 + mod) % mod;

            ans = (ans +(a[i] * n4) % mod) % mod;
        }
        cout << ans % mod << endl;
    }

    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 68ms
memory: 12872kb

input:

100000
36967178 752077122 899978907 521018044 925360418 267380970 199698530 677842622 395705049 713493724 626147704 827554719 734174727 628149163 731456688 735932512 165335261 961529158 144189583 974116519 739012212 142215106 992295003 210685693 625600330 670647812 636190924 763436680 493995372 4735...

output:

882006095
177429836
87725897
642334982
624917696
585352228
463977870
390469837
-914698281
600648670

result:

wrong answer 9th numbers differ - expected: '85301726', found: '-914698281'