-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReplacement.cpp
More file actions
48 lines (38 loc) · 968 Bytes
/
Replacement.cpp
File metadata and controls
48 lines (38 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <cstdio>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n, m;
scanf("%d %d", &n, &m);
string str;
cin >> str;
vector<pair<int, int> > terms;
bool isDot = false;
int start = 0;
for(int i = 0; i < n; i++) {
if(str[i] == '.' && isDot == false) {
isDot = true;
start = i;
} else {
if(i - start >= 2) {
terms.push_back(make_pair<int, int>(start, i - 1));
}
isDot = false;
}
}
for(int i = 0; i < m; i++) {
int pos;
char letter;
scanf("%d %c", &pos, &letter);
for(int j = 0, len = terms.size(); j < len; j++) {
pair<int, int> boundary = terms[j];
if(boundary.first <= pos && pos <= boundary.second) {
}
}
printf("%d\n", result);
}
return 0;
}