6 条题解

  • 0
    @ 2024-6-2 18:22:36

    #include using namespace std; const int N = 1e5 + 10; const int INF = 0X3f3f3f;

    struct node { bool id; string name; }a[N];

    int n , m , x , y , pos = 1; int main(){ cin >> n >> m; for(int i = 1; i <= n; i++) cin >> a[i].id >> a[i].name;

    while(m--)
    {
    	cin >> x >> y;
    	if( !a[pos].id && x || a[pos].id && !x )
    	    pos += y;
    	else
    	    pos -= y;
    	while( pos <= 0) pos += n;
    	pos = (pos - 1) % n + 1;	    
    }   
    cout << a[pos].name;
    
    
    
    
    
    return 0;
    

    }

    信息

    ID
    762
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    203
    已通过
    40
    上传者