QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#847197#5734. Issuing PlatesLaVuna47#AC ✓1ms3792kbC++202.0kb2025-01-07 18:45:552025-01-07 18:45:57

Judging History

你现在查看的是最新测评结果

  • [2025-01-07 18:45:57]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3792kb
  • [2025-01-07 18:45:55]
  • 提交

answer

/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double LD;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif


vector<char> V{'O', 'L', 'Z', 'E', '?', 'S', 'B', 'T', 'B', '?', '?', '?'};

bool equal(char a, char b)
{
	
	return a==b || ((b>='0' && b <='9') && a==V[b-'0']);
}

bool equal(const string& s, const string& t)
{
	FOR(i,0, sz(s))
	{
		if(!equal(s[i], t[i]))return false;
	}
	return true;
}

int solve()
{	
	int n, m;
	if(!(cin>>n>>m))return 1;
	vector<string> wo(n);
	for(auto& w: wo) cin >> w;
	FOR(_,0,m)
	{
		string w;
		cin >> w;
		bool ok =true;
		
		for(auto bad: wo)
		{
			
			FOR(i,0,sz(w)-sz(bad)+1)
			{
				if(equal(bad, w.substr(i,sz(bad))))
					ok=false;
			}
		}
		
		if(!ok)cout<<"IN";
		cout<<"VALID\n";
	}
    return 0;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int TET = 1e9;
    //cin >> TET;
    for (int i = 1; i <= TET; i++)
    {
        if (solve())
        {
            break;
        }
#ifdef ONPC
        cout << "__________________________" << endl;
#endif
    }
#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

input:

7 2
AWFUL
BAD
CRUMMY
LOUSY
POOR
SAD
TERRIBLE
SO5OD
TROUBADOUR

output:

VALID
INVALID

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 3792kb

input:

100 100
VPTRZGMVNOIPKBATVKYUKBW
HZNDYGKCFTMITPOGBWMVPPHMJ
VHNEYPPUYLZVOSO
ABTGHQAINFHE
ZLUHFHNAAZBK
TVZDDUYVELOPEWZGOCVXNFRKX
BCUNRSKHVTCPPMPLYUYTJJYD
YSVVDDIWZMUD
PIYTPZB
CIIHPTLUJDODKSAROCK
WDP
ZZOYWYLMPZURKYIUGSZRXBTT
PXSJQMINFOQORDMQJGRLGHOT
APRGCELXVOEZTOIM
KBMZ
WNMLCRDM
NIEYIKPYLOCTNIM
FZEDDPQ...

output:

INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
VALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
VALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
...

result:

ok 100 lines

Test #3:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

100 100
EGHJXUVYMYTRHUYYUBAFMRNR
G
EJPNPXJTRQGQFPQWERCC
QUA
KLZSMUXRXMYQTBC
MNOCMDYAIQNKTODYRK
CICPHCGS
JBIEWYHNBFAYOKXVLOBRAW
VPZFXDZL
GLHGNPJAZPCDMOUV
ILGAVUVMWQUSOJVEJSTU
UIVDREQAYZIFCTDIWZSHOK
GMNBGPBDRQDJNR
CBYNQFMIDB
L
MHEADJYINCGRPHBFDJ
ZRYHOGQVKBAOWSQ
QDEFJFGSSXXQOVOLYL
WSLZOZFVEXOWX
ZOLZPSQ...

output:

INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
VALID
INVALID
INVALID
INVALID
VALID
INVALID
INVALID
VALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
VALID
VALI...

result:

ok 100 lines

Test #4:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

100 100
VQYJQUZSNQLHQYDRGURIHYMXQ
UHUZMEPDSVH
EFMZBMPSQSEHJRBNO
YLU
EHRVCUSOBFAUH
MBOKEUWOLJD
TUHXUFOOYONRORT
SW
PPGGHLEYCRNLNKYIKEIZA
MOCFLWHKNEVNQJOGLGQUHBJH
LAEYOOPBH
WSCHGRP
JCOBDEJNJFHCUPR
HFUITTKPJYJTYGBAZCHVU
KRWVHEDMIJVEC
HD
LCXUBQWQVXMLPVA
VTFYFDVADGXMKAPQMQRAZVAKA
WXMTYBSEWKRFVYZPQ
MRGJPQB...

output:

VALID
VALID
VALID
VALID
INVALID
VALID
VALID
VALID
VALID
VALID
VALID
INVALID
VALID
VALID
INVALID
INVALID
VALID
VALID
INVALID
VALID
INVALID
VALID
VALID
VALID
VALID
INVALID
VALID
VALID
VALID
VALID
INVALID
VALID
INVALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
INVALID
INVALID
INVALID
...

result:

ok 100 lines

Test #5:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

100 100
ZR
YYLOGRZZENIAMOQOCHXGAD
DVKLVVGKCSCX
TAGYJNSO
HMIGT
RYIRFPJQVZOKZPANNXCR
UPVADAGKADXOAVSWYVHKHA
DCMDRYVCPR
WMXNHNDQKYFS
TZFXBJTUTLPXYAVQ
ENSXWHQCXAKVSBMTPNEY
VJXVZQWWMZLCNEIAFPUM
QFAJWPFONRPJTTOCXAPHAYNO
MGZKRPERMNSHKRSNMNXVPW
O
MKQTHSONNMQFYZWCXYUTGJCXL
JITZGEHLQXMKYXXHKHEG
QVDBLASFZPTYMI...

output:

INVALID
INVALID
INVALID
INVALID
VALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
VALID
INVALID
VALID
VALID
INVALID
INVALID
INVALID
INVALID
VALID
VALID
INVALID
INVALID
INVALID
INVALID
INVALID
VALID
INVALID
INVALID
VA...

result:

ok 100 lines

Test #6:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

100 100
VLZGRYPQQIV
YSEUYJYKMJVFYX
R
GDEBTTDQILLWAI
GEMPWGHXWZUPOQ
XGISWGDRLIOF
D
BWOVFSJCUSSFWMPMG
LEXMSEWJJEERGEZAXKME
BLAJGU
TQ
LEKFGMCLGJQIBJSC
QGKFRXAZNCMJNCMGSNDVDLJYD
FWDXY
CNJDAPSCHJEZLLROXV
VAKYRBUSNXNOWTEPO
CHSVLNXJZNMUTRXTMXFVMUFMI
KQGZRIMGVF
OXQOEDAWNID
NJ
GMXVXKYXQZBBJOOZQOBMRAU
UGEIDDR...

output:

VALID
VALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
VALID
INVALID
VALID
VALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
INVALID
VALID
INVALID
...

result:

ok 100 lines

Test #7:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

100 100
QUBHTEIRFZOOO
L
JUSR
UAU
SZSNBGMRZHXHGRYBGKNZ
PTWE
VHXWLBHFNBURYPA
QIKUYCAZYNLOGLKA
IDTCFB
EYBLNDWQINCDXAGQVLU
UNFHG
SPOFFAWSQRJCIJGYDQPNCHSS
UCMXANPYZLLXSFSJV
N
PCSZJZJLBKCQUZL
ZZBVLGVY
VIYUGARXJZDIVTLGJBFXRPDZU
GQUJCIHYGRVT
Y
XDHVWGCODYFCTMJOUXEXCSM
FRYLCCQ
ARQNRBESWLZVODKLWYNWOXD
WODNBZLJ...

output:

INVALID
INVALID
VALID
INVALID
VALID
INVALID
VALID
VALID
INVALID
VALID
VALID
INVALID
VALID
INVALID
INVALID
INVALID
INVALID
INVALID
VALID
INVALID
INVALID
VALID
VALID
INVALID
INVALID
VALID
INVALID
VALID
VALID
INVALID
INVALID
INVALID
VALID
VALID
INVALID
INVALID
INVALID
INVALID
VALID
INVALID
VALID
INVALI...

result:

ok 100 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

8 80
AOA
BLB
CZC
DED
ESE
FBF
GTG
HBH
A0A
A1A
A2A
A3A
A4A
A5A
A6A
A7A
A8A
A9A
B0B
B1B
B2B
B3B
B4B
B5B
B6B
B7B
B8B
B9B
C0C
C1C
C2C
C3C
C4C
C5C
C6C
C7C
C8C
C9C
D0D
D1D
D2D
D3D
D4D
D5D
D6D
D7D
D8D
D9D
E0E
E1E
E2E
E3E
E4E
E5E
E6E
E7E
E8E
E9E
F0F
F1F
F2F
F3F
F4F
F5F
F6F
F7F
F8F
F9F
G0G
G1G
G2G
G3G
G4G
G5G...

output:

INVALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
INVALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
INVALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
INVALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
VALID
INVALID
VALID
VALID
VA...

result:

ok 80 lines