Problem 1577-k-th character
Topic Abstraction: Give you a string that gives you some action, each of which reverses the substring [l,r]. After all the operations are complete, ask for some characters on the location.
Idea: Just reverse lookup on the line. Such a small thought is sometimes unexpected.
1#include <iostream>2#include <cstdio>3#include <cstring>4#include <cmath>5#include <algorithm>6 using namespacestd;7 Const intms=1e5+5;8 Const intSize=1005;9 Ten CharStr[ms]; One intX[size],y[size]; A intn,m,q; - - intMain () the { - while(SCANF ("%d%d%d", &n,&m,&q)! =EOF) - { -scanf"%s", str); + for(intI=0; i<m;i++) -scanf"%d%d",&x[i],&y[i]); + intT; A for(intI=0; i<q;i++) at { -scanf"%d",&t); - for(intj=m-1; j>=0; j--) - { - if(t>=x[j]&&t<=Y[j]) - { int=x[j]+y[j]-T; - } to } +printf"%c", str[t-1]); - } theprintf"\ n"); * } $ return 0;Panax Notoginseng}
Problem 1577-k-th Character Small thinking problem reverse lookup