QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#797974 | #9578. 爱上字典 | Lynia | WA | 0ms | 3624kb | C++23 | 3.2kb | 2024-12-03 22:07:08 | 2024-12-03 22:07:09 |
Judging History
answer
///////////
// // //
// ////////////////////
// // //
//
///////////
//
//
// // // //////// /\ /////////
// // // // // // //
// //////// // // // // //
// // // // // // //
////////// //////// // // // /////////////
#pragma GCC optimize(3,"Ofast","inline")
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <list>
#include <stack>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <random>
#include <numeric>
#include <functional>
#include <optional>
//#include <Windows.h>
using namespace std;
#define fa(i,op,n) for (int i = op; i <= n; i++)
#define fb(j,op,n) for (int j = op; j >= n; j--)
#define pb push_back
#define HashMap unordered_map
#define HashSet unordered_set
#define var auto
#define all(i) i.begin(), i.end()
#define all1(i) i.begin() + 1,i.end()
#define endl '\n'
#define px first
#define py second
using VI = vector<int>;
using VL = vector<long long>;
using ll = long long;
using ull = unsigned long long;
using db = double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T1, class T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& p) {
out << '(' << p.first << ", " << p.second << ')';
return out;
}
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& ve) {
for (T i : ve)
out << i << ' ';
return out;
}
template<class T1, class T2>
ostream& operator<<(ostream& out, const map<T1, T2>& mp) {
for (auto i : mp)
out << i << '\n';
return out;
}
template<typename ...T>
bool _debug(T... a) {
((cout << a << ' '), ...);
cout << endl;
return -1;
}
const int INF = 0x3f3f3f3f;
const ll LNF = 0x3f3f3f3f3f3f3f3f;
int dx[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 0, 1, -1, 1, -1, -1, 1 };
//#include "Lynia.h"
namespace MyTools
{
template <typename T>
class Math;
template <const int T>
class ModInt;
}
namespace MT = MyTools;
using Math = MT::Math<ll>;
#define geo MT::Geo
const int mod = 1e9 + 7;
using mint = MT::ModInt<mod>;
const int N = 2e5 + 10;
void solve(int CASE)
{
string a; getline(cin, a);
int n; cin >> n;
set<string>se;
fa(i, 1, n) {
string now; cin >> now;
se.insert(now);
}
for (char& i : a)if (i >= 'A' and i <= 'Z')i += 32;
int ans = 0;
int j = 0;
fa(i, 0, a.size()) {
if (a[i] == ' ' or i == a.size()) {
int len = i - 1 - j + 1;
if (a[i - 1] == '.' or a[i - 1] == '?' or a[i - 1] == '!' or a[i - 1] == ',') {
len--;
}
string now = a.substr(j, len);
if (!se.count(now))ans++;
else se.insert(now);
j = i + 1;
}
}
cout << ans << endl;
return;
}
int main()
{
//SetConsoleOutputCP(CP_UTF8);
//ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int _ = 1;
//cin >> _;
fa(i, 1, _)solve(i);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3512kb
input:
I love Liaoning. Love Dalian! 1 love
output:
3
result:
ok single line: '3'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3624kb
input:
Sulfox Loves Furry! Fur fur Furred. 2 anthropomorphic furry
output:
5
result:
wrong answer 1st lines differ - expected: '4', found: '5'