QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#887119#10049. Grid Coloringmodwwe0 19ms6892kbC++232.6kb2025-02-07 15:11:442025-02-07 15:11:45

Judging History

This is the latest submission verdict.

  • [2025-02-07 15:11:45]
  • Judged
  • Verdict: 0
  • Time: 19ms
  • Memory: 6892kb
  • [2025-02-07 15:11:44]
  • Submitted

answer

#pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
#define int   long long
#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define NHP     ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define modwwe  int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task2 "ftree"
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".out","w",stdout)
#define pb push_back
#define mask(k) (1<<k)
#define mp make_pair
#define checktime   cerr << (double)clock() / CLOCKS_PER_SEC * 1000  << " ms";
using namespace std;
#define getchar_unlocked getchar
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());

int rand(int l,int r)
{
    return uniform_int_distribution<int>(l,r)(rd);
}
inline int scan()
{
    char c = getchar_unlocked();
    int x = 0;
    while (c < '0' || c > '9')
    {
        c = getchar_unlocked();
    }
    while (c >= '0' && c <= '9')
    {
        x = (x << 1) + (x << 3) + c - '0';
        c = getchar_unlocked();
    }
    return x;
}
void phongbeo();
const int inf = 1e16;
const ll mod2 = 1e9+7;
const int  mod1 = 998244353;
const ll base=67;
int add(int x,int y)
{
    if(x+y>=mod2) x-=mod2;
    if(x+y<0)x+=mod2;
    return x+y;
}
struct icd
{
    long double a;
    int b;
};
struct ib
{
    int a;
    int b;
};
struct ic
{
    int a,b,c;
};
struct id
{
    int a, b, c, d;
};
struct ie
{
    int a, b, c, d, e;

};
int  n, m, s1, s2, s4, s3, sf, k, s5, s6, mx, s7, s8, s9, mx2, res, dem2 = 0, dem = 0, s33, dem3, dem4, mid, l2, r2, center;
int  i, s10, s12,k1,k2,k3,s11,lim,w,l,r ;
int kk;
int el = 19;
main()
{
    if(fopen(task2".inp","r"))
    {
        fin(task2);
        fou(task2);
    }
    if(fopen(task".inp","r"))
    {
        fin(task);
        fou(task);
    }
    NHP
    /// cin>>s1;
    //modwwe
    phongbeo(),down
    // checktime
}
int a[200001];
int b[200001];
void phongbeo()
{
    cin>>n;
    s2=0;
    s3=0;
    for(int i=1; i<=n; i++)
        cin>>a[i],s4=max(s4,a[i]);
    for(int i=1; i<=n; i++)
        cin>>b[i],s4=max(s4,a[i]);
    for(int i=1; i<=n; i++)
    {
        if(a[i]==s4)dem++;
        if(b[i]==s4) dem++;
    }
    for(int i=2; i<=n; i++)
        if(a[i]==s4)
        {
            s2=n-i+1;
            break;
        }
    for(int i=2; i<=n; i++)
        if(b[i]==s4)
        {
            s3=n-i+1;
            break;
        }
    cout<<s4<<" "<<(s2+s3)*(n-1)-s2*s3+dem-(a[1]==s4);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5740kb

input:

500
443 443 567 680 1057 1143 1196 1213 1385 1534 1621 1741 1812 1944 2186 2861 2970 3022 3385 3451 3902 3968 4007 4048 4066 4109 4162 4997 5031 5043 5051 5311 5612 5735 5914 6068 6125 6269 6354 6683 7095 7134 7285 7500 7507 7550 7681 7829 7905 8039 8047 8111 8438 8453 8476 8842 8900 9051 9154 9224 ...

output:

99894 500

result:

wrong answer 1st lines differ - expected: '443 501', found: '99894 500'

Subtask #2:

score: 0
Wrong Answer

Test #21:

score: 0
Wrong Answer
time: 1ms
memory: 5868kb

input:

500
4195946 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 600922 6...

output:

4195946 249003

result:

wrong answer 1st lines differ - expected: '4195946 501', found: '4195946 249003'

Subtask #3:

score: 0
Wrong Answer

Test #38:

score: 0
Wrong Answer
time: 4ms
memory: 4352kb

input:

47321
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

2 1119638520

result:

wrong answer 1st lines differ - expected: '1 1119638521', found: '2 1119638520'

Subtask #4:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 19ms
memory: 6764kb

input:

200000
920 1463 4431 7058 11118 13005 30856 33341 34539 39227 40209 43007 43510 49602 51105 55241 55810 56016 57083 58973 60147 62082 62452 68622 70787 73408 79126 83852 86224 91963 94622 97983 98446 99211 100001 100206 101048 101583 104042 105734 109201 111247 112684 114852 116012 117918 119202 122...

output:

749435278 200000

result:

wrong answer 1st lines differ - expected: '999995694 200000', found: '749435278 200000'

Subtask #5:

score: 0
Wrong Answer

Test #63:

score: 0
Wrong Answer
time: 17ms
memory: 6892kb

input:

200000
14788 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 9714 97...

output:

14788 39999600003

result:

wrong answer 1st lines differ - expected: '14788 200001', found: '14788 39999600003'