# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
715044 | TheConverseEngineer | Sifra (COCI21_sifra) | C++17 | 1 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define sqr(x) ((ll)(x))*(x)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int a = 0;
set<string> used;
int main() {
cin.tie(0)->sync_with_stdio(0);
string s; cin >> s;
string lastInt = ""; bool lastWasInt = false;
for (char c : s) {
bool isNum = (c=='0') or (c=='1') or (c=='2') or (c=='3') or (c=='4') or (c=='5') or (c=='6') or (c=='7') or (c=='8') or (c=='9');
if (isNum) {lastInt += c;}
else if (!isNum and lastWasInt) {
if (!used.count(lastInt)) {
a++;
used.insert(lastInt);
lastInt = "";
}
}
lastWasInt = isNum;
}
if (lastWasInt and !used.count(lastInt)) {
a++;
}
cout << a;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |