wa在第四个测试点了,求帮助
查看原帖
wa在第四个测试点了,求帮助
1263263
john857楼主2024/9/15 18:12
#include<bits/stdc++.h>
#define max_size 11

using namespace std;
int main()
{ 
    int n=0,m=0;
    bool towards[100005];
    char a[100005][max_size];
    int location=1;
    int temp_lo=0,num=0;

    cin >> n >> m;
    
    for(int i=1;i<=n;i++){
        cin >> towards[i] >> a[i];
    }
    

    for(int i=0;i<m;i++){
        cin >> temp_lo >> num;
        if(towards[location]^temp_lo){
            location+=num;
            if(location>n){
                location-=n;
            }
        }
        else{
            location-=num;
            if(location<0){
            location+=n;
        }
        }
    }
    cout << a[location];
}
2024/9/15 18:12
加载中...