QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#470229#6700. Game on a Graphmufeng12AC ✓206ms3804kbC++231.8kb2024-07-10 11:27:462024-07-10 11:27:47

Judging History

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

  • [2024-07-10 11:27:47]
  • 评测
  • 测评结果:AC
  • 用时:206ms
  • 内存:3804kb
  • [2024-07-10 11:27:46]
  • 提交

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define all(x) (x).begin(),(x).end()
#define maxint INT32_MAX
#define minint INT32_MIN
#define maxll INT64_MAX
#define minll INT64_MIN
#define nc() (p1==p2 && (p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
#pragma GCC optimize(2)
void write(int x);
char *p1,*p2,buf[100000];
int read();
ll ksm(ll a,ll b,ll mod);
int js(int a,int b,int c){
    int ans1,ans;
    ans1=a+b>a*b?a+b:a*b;
    ans=ans1+c>ans1*c?ans1+c:ans1*c;
    return ans;
}

void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int bn,dn;
    cin>>bn>>dn;
    for(int i=1;i<=dn;i++){
        int x,y;
        cin>>x>>y;
    }
    int num=dn-bn+1;
    num%=n;
    cout<<(s[num]=='1'?"2":"1")<<endl;

}


int main() {
    int t=1;
    cin>>t;
    while(t--) solve();
    return 0;
}



void write(int x)
{
    if(x<0)
        putchar('-'),x=-x;
    if(x>9)
        write(x/10);
    putchar(x%10+'0');
    return;
}
int read()
{
    int x=0,f=1;
    char ch=nc();
    while(ch<48||ch>57)
    {
        if(ch=='-')
            f=-1;
        ch=nc();
    }
    while(ch>=48&&ch<=57)
        x=x*10+ch-48,ch=nc();
   	return x*f;
}
ll ksm(ll a,ll b,ll mod){
    ll ans=1;
    a%=mod;
    while(b>0){
        if(b&1) ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}

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

详细

Test #1:

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

input:

3
5
11212
4 6
0 1
0 2
0 3
1 2
1 3
2 3
5
11121
5 7
0 2
1 3
2 4
0 3
1 2
3 2
4 1
3
121
4 3
0 1
0 2
1 3

output:

2
1
2

result:

ok 3 number(s): "2 1 2"

Test #2:

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

input:

1027
28
1122121222221112112121212112
58 72
32 31
15 56
42 56
31 3
52 57
54 50
47 5
40 22
41 36
42 50
30 28
16 6
28 42
40 23
3 0
4 24
3 50
23 29
53 6
20 27
39 30
7 10
40 43
14 48
27 47
0 6
12 9
25 56
49 41
30 55
13 54
5 11
30 44
6 5
49 34
22 33
1 29
4 39
33 38
35 33
40 2
38 55
47 52
32 52
10 47
26 43...

output:

1
1
2
1
2
2
1
2
1
2
2
2
2
2
1
2
1
2
1
2
2
2
2
1
2
2
1
1
2
1
2
1
2
1
2
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
1
1
2
1
1
2
1
2
1
1
1
2
1
2
1
2
1
1
2
1
1
1
2
1
1
1
1
2
1
1
1
1
2
2
1
1
2
1
1
2
2
2
1
2
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
2
2
1
2
1
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
1
1
2
2
1
1
2
1
2
2
1
2
2
2
1
...

result:

ok 1027 numbers