QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#136179 | #186. Street Lamps | Mohammed_Atalah# | 0 | 598ms | 3796kb | C++17 | 2.1kb | 2023-08-07 15:28:32 | 2024-07-04 01:22:06 |
Judging History
answer
/// Template path: /home/mohammed/.config/sublime-text-3/Packages/User
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
// typedef
typedef long long ll;
typedef long double ld;
typedef vector<int> vecint;
typedef vector<char> vecchar;
typedef vector<string> vecstr;
typedef vector<long long> vecll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// Marcos
#define endl ("\n")
#define int long long
#define mod 1000000007
#define pi (3.141592653589)
#define REP(i,a,b) for (int i = a; i < b; i++)
#define RREP(i,a,b) for (int i = a; i > b; i--)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
// Functions
long long squared(long long x) {return (x * x) % mod;}
int factorial(int n) {long long res = 1; for (int i = 1; i <= n; i++) {res = ((res * i) % mod + mod) % mod ;} return res;}
long long power(long long x, long long p) {if (p == 0) {return 1;} if (p % 2 == 1) {return (power(x, p - 1) * x) % mod;} return squared(power(x, p / 2));}
// cout << fixed;
// cout << setprecision(4);
// ---------(^_^)--------- //
void main_solve() {
int n, q; cin >> n >> q;
string s; cin >> s;
map<int, map<int, int>> mp;
int e = 0;
while (q--) {
e++;
string type; cin >> type;
if (type == "toggle") {
for (int i = 0; i < n ; i ++) {
if (s[i] == '0') continue;
mp[i][i + 1]++;
}
int x; cin >> x;
if (s[x - 1] == '0') {
s[x - 1] = '1';
} else {
s[x - 1] = '0';
}
continue;
}
for (int i = 0; i < n ; i ++) {
if (s[i] == '0') continue;
mp[i][i + 1]++;
}
if (type == "query") {
int a, b; cin >> a >> b;
cout << mp[a - 1][b - 1] << endl;
}
}
}
int32_t main() {
fast;
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
// Just another problem (-_-)
int t;
t = 1;
// cin >> t;
while (t--) {
main_solve();
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3592kb
input:
5 7 11011 query 1 2 query 1 2 query 1 6 query 3 4 toggle 3 query 3 4 query 1 6
output:
1 2 0 0 1 0
result:
wrong answer 6th lines differ - expected: '2', found: '0'
Subtask #2:
score: 0
Time Limit Exceeded
Test #9:
score: 20
Accepted
time: 207ms
memory: 3796kb
input:
100 300000 1100100000000101010010100111010001100010001100111101000010111110001101101110100100100110101010110010 query 13 14 query 42 43 toggle 64 query 78 79 toggle 85 query 35 36 toggle 35 query 4 5 toggle 5 query 4 5 query 42 43 query 35 36 query 13 14 query 14 15 toggle 15 toggle 31 query 20 21 q...
output:
0 0 0 6 0 0 0 7 0 14 0 18 0 0 21 0 26 0 0 36 38 15 41 44 0 47 20 50 52 0 55 52 56 0 35 31 70 73 7 4 0 0 51 83 84 90 44 0 95 97 0 70 0 103 26 8 46 20 109 122 20 109 108 0 0 28 0 135 139 112 35 142 53 146 0 151 0 153 0 0 73 0 164 0 100 0 33 173 135 151 178 180 75 133 189 46 0 197 23 0 200 0 141 206 20...
result:
ok 150010 lines
Test #10:
score: 20
Accepted
time: 598ms
memory: 3524kb
input:
300 300000 0000110011011101000000010110111010000011000110111111110000110101001100010001010111101111110101100110101111100110110110100000101000001001010110001111100110101100011101011010100111011100111100001011010011000101011101000101010010011001100101000011110000000101000001001101001011110101000100110...
output:
0 0 0 10 0 0 14 0 0 0 22 29 31 0 35 31 0 40 41 0 44 0 0 0 51 20 61 62 37 65 0 0 73 76 63 0 81 5 0 85 87 89 0 0 0 0 0 0 0 100 0 0 21 68 0 111 0 0 117 0 68 0 123 68 125 0 128 0 130 131 0 0 0 137 139 140 142 143 0 147 0 152 154 0 163 0 0 167 0 82 172 174 0 0 177 0 0 0 146 189 0 71 144 0 205 192 154 59 ...
result:
ok 149998 lines
Test #11:
score: 0
Time Limit Exceeded
input:
5000 300000 011100011011111101000001011111000101101001000111000101111010100100000100000000000100000100011100001101011000000000000010110011101101011011100100010001011001101101000000111000011101100010001001011000010001101111000001011110110010111001100100111001011101001010101011011110110110111011000100...
output:
0 0 3 0 0 6 7 0 10 18 19 24 0 0 28 0 30 0 33 0 0 41 0 47 0 0 0 0 56 0 62 63 64 65 66 0 71 0 76 80 0 87 0 90 95 0 0 0 102 103 104 108 111 113 0 0 0 121 0 125 0 0 0 130 131 0 0 0 0 144 0 146 0 149 150 152 153 0 0 0 0 162 0 0 169 0 0 0 180 181 182 183 0 185 187 0 0 0 0 0 202 0 0 0 0 0 217 132 0 0 223 2...
result:
Subtask #3:
score: 0
Wrong Answer
Test #17:
score: 20
Accepted
time: 13ms
memory: 3632kb
input:
1000 1003 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0 0 0
result:
ok 3 lines
Test #18:
score: 0
Wrong Answer
time: 18ms
memory: 3756kb
input:
1000 1003 00100001101000000001000001001000100010000010010010001001001010001010101100010001000010101100000001001111000001110000010110100000100110001000000101001110000001110001000100000011001110000011010100101000000010100110100010000000110000111100100000011000100010010100000000100000000010001001110101...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 249th lines differ - expected: '26', found: '0'
Subtask #4:
score: 0
Wrong Answer
Test #30:
score: 0
Wrong Answer
time: 2ms
memory: 3660kb
input:
1000 1003 10111011001010101101100010101100100010100110001000000001001100111110101100110100010001111101101100110111110100011000111101100100000110110010101011101001101110111100010100100000110001010001111101001010100101011111010000001110111110001011010111101100000001001110101110011111000101101100011010...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 262nd lines differ - expected: '274', found: '0'
Subtask #5:
score: 0
Skipped
Dependency #1:
0%