QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#877729#1133. Monster Gamemodwwe0 16ms3840kbC++233.2kb2025-02-01 01:52:022025-02-01 01:52:09

Judging History

This is the latest submission verdict.

  • [2025-02-01 01:52:09]
  • Judged
  • Verdict: 0
  • Time: 16ms
  • Memory: 3840kb
  • [2025-02-01 01:52:02]
  • Submitted

answer

/// try my best
#include "monster.h"
#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());
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;

};
ll  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;
ll  i, s10, s12,k1,k2,k3,s11,lim,w,l,r ;
ll kk;
ll 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
}*/
/// read sol
/// code trâu ra nhân xét
///  [1,0] [3,2,1] [7,6,5,4]
/// vì giả sử [1,0] [3,2] thì 1 sẽ chỉ còn lớn hơn 2 nên bắt buộc phải 1
vector<int> h,a;
/*
bool Query(int x, int y)
{
    if(abs(h[x]-h[y])==1)return h[x]<h[y];
    return h[x]>h[y];
}*/
int cast(int y)
{
    dem=0;
    for(int i=0; i<n; i++)
    {
        if(i==y) continue;
        dem+=Query(a[y],a[i]);
    }
    return dem;
}
vector<int> Solve(int n)
{
    a.pb(0);
    if(n==1) return a;
    for(int i=1; i<n; i++)
    {
        l=0;
        r=a.size()-1;
        while(l<=r)
        {
            int mid=l+r>>1;
            if(Query(i,a[mid])) l=mid+1;
            else r=mid-1;
        }
        a.insert(a.begin()+l,i);
    }
    int hihi;
    s2=cast(0);
    if(s2==1)
    {
        s3=cast(1);
        if(s3==1)hihi=1;
        else hihi=0;
    }
    else
    {
        hihi=s2;
    }
    int start=0;
    vector<int> ans;
    ans.resize(n);
    while(start<n)
    {
        for(int j=start; j<=hihi; j++)            ans[a[j]]=start-j+hihi;

        int dd=hihi+1;
        while(dd<n&&Query(a[dd],a[start]))dd++;
        start=hihi+1;
        hihi=dd;
    }
    return ans;
}
void phongbeo()
{
    cin>>n;
    for(int i=1; i<=n; i++)
        h.pb(i);
    shuffle(h.begin(),h.end(),rd);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 0ms
memory: 3712kb

input:

4
1
0
0
1
1
1
0

output:

Q 1 0
Q 2 0
Q 3 0
Q 3 2
Q 3 2
Q 0 2
Q 1 2
F 4
 2 1 0 3

result:

points 1.0 points  1.0

Test #2:

score: 10
Accepted
time: 1ms
memory: 3840kb

input:

4
0
0
0
1
1
1
0

output:

Q 1 0
Q 2 1
Q 3 1
Q 3 2
Q 3 2
Q 1 2
Q 0 2
F 4
 1 2 0 3

result:

points 1.0 points  1.0

Test #3:

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

input:

4
0
0
1
1
1
1
0

output:

Q 1 0
Q 2 1
Q 3 1
Q 3 0
Q 1 2
Q 0 2
Q 3 2
F 4
 2 3 0 1

result:

wrong answer Wrong Answer [3]

Subtask #2:

score: 0
Wrong Answer

Test #33:

score: 15
Accepted
time: 11ms
memory: 3712kb

input:

995
1
1
0
0
0
1
0
0
1
0
0
1
0
1
0
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
0
0
1
1
1
1
0
0
1
0
1
0
1
0
0
0
1
0
1
0
1
1
1
0
1
1
0
0
1
0
1
1
0
0
1
1
1
0
0
1
0
1
1
1
0
0
1
0
1
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
0
1
0
1
1
1
1
0
0
1
0
0
1
0
0
0
0
1
0
1
1
1
0
0
0
0
0
0
1
1
1
1
0
0
1
0
0
0
1
0
1
0
0
1
1
0
0
0
0
0
...

output:

Q 1 0
Q 2 0
Q 2 1
Q 3 2
Q 3 0
Q 4 0
Q 4 2
Q 5 4
Q 5 3
Q 5 0
Q 6 0
Q 6 3
Q 6 5
Q 7 0
Q 7 2
Q 7 4
Q 8 0
Q 8 7
Q 8 2
Q 9 4
Q 9 8
Q 9 2
Q 9 1
Q 10 4
Q 10 2
Q 10 1
Q 10 9
Q 11 7
Q 11 5
Q 11 0
Q 11 4
Q 12 11
Q 12 2
Q 12 7
Q 12 8
Q 13 7
Q 13 5
Q 13 4
Q 13 11
Q 14 13
Q 14 2
Q 14 12
Q 14 7
Q 15 7
Q 15 0
Q 15...

result:

points 1.0 points  1.0

Test #34:

score: 0
Wrong Answer
time: 12ms
memory: 3712kb

input:

996
0
0
0
1
1
0
0
0
1
1
0
1
1
0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