mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 13:18:46 +00:00
2217. [Poi2011] Lollipop
https://hydro.ac/d/bzoj/record/63a45e17b053be17396a0564
This commit is contained in:
parent
8b92825acc
commit
cf4ca87591
58
BZOJ/2217/2217.cpp
Normal file
58
BZOJ/2217/2217.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1e6 + 5,
|
||||
M = 2e6 + 5;
|
||||
|
||||
int n, m, a[N], s[N], l[M], r[M];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> m;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
char c;
|
||||
|
||||
cin >> c;
|
||||
|
||||
a[i] = c == 'T' ? 2 : 1;
|
||||
}
|
||||
|
||||
for (int i = n; i; i--) {
|
||||
s[i] = a[i] == 2 ? s[i + 1] + 1 : 0;
|
||||
}
|
||||
|
||||
for (int i = 1, sum = 0; i <= n; i++) {
|
||||
sum += a[i];
|
||||
l[sum] = 1, r[sum] = i;
|
||||
|
||||
if (a[i] == 2) {
|
||||
if (s[i] > s[1]) {
|
||||
l[sum - 1] = s[1] + 2;
|
||||
r[sum - 1] = s[1] + i;
|
||||
} else if (s[i] != n - i + 1) {
|
||||
l[sum - 1] = s[i] + 1;
|
||||
r[sum - 1] = s[i] + i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (m--) {
|
||||
int k;
|
||||
|
||||
cin >> k;
|
||||
|
||||
if (!l[k]) {
|
||||
cout << "NIE" << endl;
|
||||
} else {
|
||||
cout << l[k] << ' ' << r[k] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
BZOJ/2217/data/1.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/1.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/10.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/10.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/11.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/11.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/12.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/12.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/13.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/13.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/14.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/14.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/15.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/15.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/16.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/16.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/17.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/17.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/18.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/18.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/19.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/19.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/2.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/2.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/20.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/20.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/21.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/21.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/22.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/22.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/23.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/23.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/24.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/24.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/25.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/25.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/26.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/26.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/27.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/27.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/28.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/28.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/29.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/29.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/3.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/3.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/30.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/30.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/31.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/31.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/32.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/32.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/32.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/33.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/33.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/33.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/34.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/34.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/34.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/35.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/35.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/35.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/36.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/36.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/36.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/37.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/37.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/37.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/38.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/38.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/38.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/39.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/39.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/39.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/4.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/4.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/40.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/40.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/40.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/41.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/41.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/41.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/41.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/5.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/5.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/6.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/6.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/7.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/7.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/8.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/8.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/9.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2217/data/9.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2217/data/9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user