QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#545545#4364. Ceiling FunctionPhantomThreshold#WA 0ms3796kbC++201.3kb2024-09-03 14:53:022024-09-03 14:53:02

Judging History

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

  • [2024-09-03 14:53:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3796kb
  • [2024-09-03 14:53:02]
  • 提交

answer

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

int main()
{
    int n,k;
    cin>>n>>k;
    map<pair<int,int>,int> mp;
    int idx=0;
    vector<int> rootv;
    for(int i=1;i<=n;i++)
    {
        vector<int> a(k+5),dp(k+5),lson(k+5),rson(k+5);
        auto ins=[&](auto &&self,int cur,int pos)->void
        {
            if(a[pos]<a[cur])
            {
                if(not lson[cur]){lson[cur]=pos;return;}
                self(self,lson[cur],pos);
            }
            else
            {
                if(not rson[cur]){rson[cur]=pos;return;}
                self(self,rson[cur],pos);
            }
        };
        for(int j=1;j<=k;j++)
        {
            cin>>a[j];
            if(j!=1)ins(ins,1,j);
        }
        auto dfs=[&](auto &&self,int u)->void
        {
            if(lson[u])self(self,lson[u]);
            if(rson[u])self(self,rson[u]);
            if(not mp.contains(make_pair(lson[u],rson[u])))
            {
                mp[make_pair(lson[u],rson[u])]=++idx;
            }
            dp[u]=mp[make_pair(lson[u],rson[u])];
        };
        dfs(dfs,1);
        rootv.push_back(dp[1]);
    }
    sort(rootv.begin(),rootv.end());
    cout<<unique(rootv.begin(),rootv.end())-rootv.begin()<<endl;
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3532kb

input:

5 3
2 7 1
3 1 4
1 5 9
2 6 5
9 7 3

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

3 4
3 1 2 40000
3 4 2 1
33 42 17 23

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

1 1
1

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

2 2
1 2
2 1

output:

2

result:

ok single line: '2'

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3572kb

input:

24 4
2 1 4 3
3 4 2 1
2 3 1 4
3 2 4 1
4 1 3 2
2 3 4 1
1 2 3 4
1 2 4 3
4 3 2 1
3 2 1 4
3 1 4 2
2 4 3 1
1 4 3 2
4 1 2 3
1 4 2 3
4 2 3 1
4 3 1 2
3 1 2 4
2 4 1 3
3 4 1 2
1 3 4 2
2 1 3 4
4 2 1 3
1 3 2 4

output:

6

result:

wrong answer 1st lines differ - expected: '14', found: '6'