QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789200#8934. Challenge NPCBaseAI#AC ✓21ms5392kbC++231.2kb2024-11-27 19:31:022024-11-27 19:31:03

Judging History

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

  • [2024-11-27 19:31:03]
  • 评测
  • 测评结果:AC
  • 用时:21ms
  • 内存:5392kb
  • [2024-11-27 19:31:02]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

#define Endl '\n'
#define ll long long
#define ls first
#define rs second
#define pii pair<int,int>
#define pb push_back
const int N=1e3+3;

ll n,k;
ll v[N][3];
pii a[N];
vector<pii> edge;
void solve()
{
    cin>>k;
    n=2*k+2;
    v[1][1]=1;
    a[1]={1,1};
    for(int i=2;i<=n;i+=2)
    {
        v[i/2+1][1+(i%4!=0)]=i;
        a[i]={i/2+1,1+(i%4!=0)};
    }
    for(int i=3;i<=n;i+=2)
    {
        v[(i-1)/2][1+((i-1)%4!=0)]=i;
        a[i]={(i-1)/2,1+((i-1)%4!=0)};
    }
    // for(int i=1;i<=k+2;i++)
    // {
    //     for(int j=1;j<=2;j++)
    //     {
    //         cout<<i<<" "<<j<<" "<<v[i][j]<<Endl;
    //     }
    // }
    for(int i=2;i<=n;i++)
    {

        for(int j=1;j<=a[i].ls-1;j++)
        {
            edge.pb({v[j][3-a[i].rs],i});
        }
    }
    cout<<n<<" "<<edge.size()<<" 2"<<Endl;
    for(int i=1;i<=n;i++)
    {
        cout<<a[i].rs<<" ";
    }
    cout<<Endl;
    for(auto [u,v]:edge)
    {
        cout<<u<<" "<<v<<Endl;
    }
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int _=1;
    // cin>>_;

    while(_--)
    {
        solve();
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

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

result:

ok ok

Test #2:

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

input:

2

output:

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

result:

ok ok

Test #3:

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

input:

3

output:

8 13 2
1 2 2 1 1 2 2 1 
1 2
3 4
2 4
3 5
1 6
5 6
4 6
1 7
5 7
3 8
2 8
7 8
6 8

result:

ok ok

Test #4:

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

input:

4

output:

10 21 2
1 2 2 1 1 2 2 1 1 2 
1 2
3 4
2 4
3 5
1 6
5 6
4 6
1 7
5 7
3 8
2 8
7 8
6 8
3 9
2 9
7 9
1 10
5 10
4 10
9 10
8 10

result:

ok ok

Test #5:

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

input:

5

output:

12 31 2
1 2 2 1 1 2 2 1 1 2 2 1 
1 2
3 4
2 4
3 5
1 6
5 6
4 6
1 7
5 7
3 8
2 8
7 8
6 8
3 9
2 9
7 9
1 10
5 10
4 10
9 10
8 10
1 11
5 11
4 11
9 11
3 12
2 12
7 12
6 12
11 12
10 12

result:

ok ok

Test #6:

score: 0
Accepted
time: 16ms
memory: 5308kb

input:

433

output:

868 187923 2
1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1...

result:

ok ok

Test #7:

score: 0
Accepted
time: 21ms
memory: 5392kb

input:

500

output:

1002 250501 2
1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 ...

result:

ok ok

Test #8:

score: 0
Accepted
time: 21ms
memory: 5276kb

input:

499

output:

1000 249501 2
1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 ...

result:

ok ok

Test #9:

score: 0
Accepted
time: 14ms
memory: 5196kb

input:

457

output:

916 209307 2
1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1...

result:

ok ok

Test #10:

score: 0
Accepted
time: 12ms
memory: 5312kb

input:

497

output:

996 247507 2
1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1...

result:

ok ok

Extra Test:

score: 0
Extra Test Passed