6 条题解
-
0iceboy LV 8 MOD @ 2017-05-01 04:36:01
treap+io优化,很快: https://vijos.org/records/59065a11d3d8a12f121640b5
-
02016-12-28 19:13:07@
STL rope / Splay
#include <bits/stdc++.h> #include <ext/rope> inline int read() { register int x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 1) + (x << 3) + (ch ^ '0'); ch = getchar(); } return x * f; } int main() { __gnu_cxx::crope rope; int t, now; static char ch[3000005]; t = read(); char s[10]; int x; while (t--) { scanf("%s", s); switch (s[0]) { case 'M': now = read(); break; case 'P': now--; break; case 'N': now++; break; case 'I': x = read(); for (int i = 0; i < x; i++) { ch[i] = getchar(); while (ch[i] == '\n')ch[i] = getchar(); } ch[x] = 0; rope.insert(now, ch); break; case 'D': x = read(); rope.erase(now, x); break; case 'G': x = read(); rope.copy(now, x, ch); ch[x] = 0; puts(ch); } } return 0; }
-
02016-04-12 21:46:23@
cin会tle......
-
02016-04-12 18:28:54@
...No cin
-
02015-02-28 09:16:39@
占沙发
-
02015-02-28 09:16:28@
沙发
- 1
信息
- ID
- 1856
- 难度
- 8
- 分类
- (无)
- 标签
- 递交数
- 588
- 已通过
- 58
- 通过率
- 10%
- 被复制
- 4
- 上传者