QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#23759#2971. Wordle with FriendsFudanU1#AC ✓3ms1968kbC++171.0kb2022-03-19 12:59:272022-04-30 04:05:52

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 04:05:52]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:1968kb
  • [2022-03-19 12:59:27]
  • 提交

answer

#include <stdio.h>
#include <algorithm>
#include <string.h>

using namespace std;

int n , w;
char z[12][12] , s[12][12];
char now[12] , ans[12];
void check ( int i ) {
	int j , k , use[10];
	for ( j = 1 ; j <= 5 ; j++ ) {
		use[j] = 0;
		ans[j] = '-';
	}
	for ( j = 1 ; j <= 5 ; j++ ) {
		if ( z[i][j] == now[j] ) {
			use[j] = 1;
			ans[j] = 'G';
		}
	}
	for ( j = 1 ; j <= 5 ; j++ ) {
		if ( ans[j] == '-' ) {
			for ( k = 1 ; k <= 5 ; k++ ) {
				if ( use[k] == 0 && z[i][j] == now[k] ) {
					use[k] = 1;
					ans[j] = 'Y';
				}
			}
		}
	}
}
void work () {
	int i , j;
	scanf ( "%d%d" , &n , &w );
	for ( i = 1 ; i <= n ; i++ ) {
		scanf ( "%s%s" , z[i] + 1 , s[i] + 1 );
	}
	for ( i = 1 ; i <= w ; i++ ) {
		scanf ( "%s" , now + 1 );
		for ( j = 1 ; j <= n ; j++ ) {
			check ( j );
			//printf ( "%s\n" , ans + 1 );
			if ( strcmp ( s[j] + 1 , ans + 1 ) != 0 ) {
				break;
			}
		}
		if ( j == n + 1 ) {
			printf ( "%s\n" , now + 1 );
		}
	}
}
int main () {
	work ();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 1828kb

input:

2 5
BERRY -G---
APPLE ---YY
MELON
BERRY
LEMON
LIMES
APPLE

output:

MELON
LEMON

result:

ok 2 lines

Test #2:

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

input:

3 5
BERRY -G---
APPLE ---YY
LIMES G-GY-
APPLE
BERRY
LEMON
LIMES
MELON

output:

LEMON

result:

ok single line: 'LEMON'

Test #3:

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

input:

3 5
BLANK --Y--
SIGHS ----G
STORM YGG-Y
ATOMS
BLANK
MOATS
SIGHS
STORM

output:

ATOMS

result:

ok single line: 'ATOMS'

Test #4:

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

input:

4 5
FRUIT -G--Y
NUTTY --Y--
ROOTS Y--YG
SEEDS -YG-G
FRUIT
NUTTY
ROOTS
SEEDS
TREES

output:

TREES

result:

ok single line: 'TREES'

Test #5:

score: 0
Accepted
time: 2ms
memory: 1828kb

input:

4 8916
ALPHA ----G
GAMMA Y--GG
DELTA ----G
OMEGA -Y-YG
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS...

output:

SIGMA

result:

ok single line: 'SIGMA'

Test #6:

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

input:

3 8916
SHARP G----
HEART -----
KNACK -G---
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS
ACARI
ACERB...

output:

SNIBS
SNIFF
SNOBS
SNOGS
SNOOD
SNOOL
SNOWS
SNOWY
SNUBS
SNUFF
SNUGS

result:

ok 11 lines

Test #7:

score: 0
Accepted
time: 2ms
memory: 1768kb

input:

3 8916
MOUNT -G---
AREAS -Y---
KICKS --GG-
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS
ACARI
ACERB...

output:

ROCKY

result:

ok single line: 'ROCKY'

Test #8:

score: 0
Accepted
time: 2ms
memory: 1968kb

input:

3 8916
IRATE Y--G-
STAIR YY-Y-
RAISE --YY-
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS
ACARI
ACERB...

output:

BINTS
BITTS
CISTS
DINTS
FISTS
GIFTS
GILTS
GISTS
HILTS
HINTS
HISTS
JILTS
KILTS
KISTS
LIFTS
LILTS
LINTS
LISTS
MILTS
MINTS
MISTS
MISTY
MITTS
PINTS
TILTS
TINTS
WILTS
WISTS
XYSTI

result:

ok 29 lines

Test #9:

score: 0
Accepted
time: 2ms
memory: 1772kb

input:

3 8916
HONOR ----Y
HELPS ----Y
SERVE Y-Y--
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS
ACARI
ACERB...

output:

ARTSY
BRISK
BRUSK
CRUST
FRISK
GRIST
RISKY
RUSTY
TRUST
TRYST
URSID
USURY
WRIST

result:

ok 13 lines

Test #10:

score: 0
Accepted
time: 3ms
memory: 1824kb

input:

1 10000
BBBBB -----
OIFHE
IAGRK
SXKHT
ULOQD
EZLIW
TOCWV
TDQWF
ZPFET
DWOGL
KFEHQ
SCWIC
PMQDH
RRMHA
MGOWZ
APWRI
WGRCR
WVZKQ
TTHPB
EXMYJ
SEAPE
XGYGI
ETGTJ
IZEOF
JSLAP
EDGTL
HNOOT
LOTNF
VKLSK
OJVXU
MLCSV
MJSUG
SCAME
DKHXC
LRUNF
NENUW
TPZGL
CLOCY
MGRTN
FFTMJ
VVTYL
DEHIU
ARPNK
UPOIH
ULCOF
MKUKB
SDFVC
SFCF...

output:

OIFHE
IAGRK
SXKHT
ULOQD
EZLIW
TOCWV
TDQWF
ZPFET
DWOGL
KFEHQ
SCWIC
PMQDH
RRMHA
MGOWZ
APWRI
WGRCR
WVZKQ
EXMYJ
SEAPE
XGYGI
ETGTJ
IZEOF
JSLAP
EDGTL
HNOOT
LOTNF
VKLSK
OJVXU
MLCSV
MJSUG
SCAME
DKHXC
LRUNF
NENUW
TPZGL
CLOCY
MGRTN
FFTMJ
VVTYL
DEHIU
ARPNK
UPOIH
ULCOF
SDFVC
SFCFW
FAONH
WUEVJ
SYCXM
XQFCH
OTSOU
...

result:

ok 8229 lines

Test #11:

score: 0
Accepted
time: 2ms
memory: 1696kb

input:

10 10000
CYHKU ----G
AQGTO --Y--
KYYHX ----Y
DPPIY -----
RLDPC -G---
LBRPO Y----
PXYBV -Y---
KODRL ----Y
PWIIL ----Y
ZIOXR ---Y-
QELBH
TCSWH
ZQBGA
OETEQ
GCSWJ
VSMOO
QPKBP
ONAKY
DSRBY
QGZNV
ACCOH
WCQBD
FOAFL
ZUADN
JUIEV
YTKTJ
DXBPD
ZISLO
PQWVY
XXGUV
FRIAP
DEMQW
AACXN
UEUOG
RPEDY
LBKOA
NWWIX
LJDFJ
SSO...

output:

GLXJU

result:

ok single line: 'GLXJU'

Test #12:

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

input:

2 3
WHITE -----
GREEN -----
BLACK
GREEN
WHITE

output:

BLACK

result:

ok single line: 'BLACK'

Test #13:

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

input:

2 3
BLACK GGGGG
GREEN -----
BLACK
GREEN
WHITE

output:

BLACK

result:

ok single line: 'BLACK'

Test #14:

score: 0
Accepted
time: 2ms
memory: 1824kb

input:

2 8916
WHITE -----
GREEN -----
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS
ACARI
ACERB
ACETA
ACHED...

output:

ABACA
ABACK
ABAKA
ABAMP
ABAYA
ABBAS
ABOMA
ABUZZ
ABYSM
ABYSS
ACOCK
ACOLD
ACYLS
ADDAX
ADOBO
AFOAM
AFOUL
ALACK
ALAMO
ALBAS
ALBUM
ALDOL
ALFAS
ALKYD
ALKYL
ALLAY
ALLOD
ALLOY
ALLYL
ALMAS
ALMUD
ALOOF
ALOUD
ALULA
ALUMS
AMASS
AMBOS
AMMOS
AMOKS
AMPLY
AMPUL
AMUCK
AMYLS
APODS
APPAL
APPLY
AQUAS
ASCUS
ASKOS
ASSAY
...

result:

ok 762 lines

Test #15:

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

input:

2 8916
BLACK GGGGG
GREEN -----
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS
ACARI
ACERB
ACETA
ACHED...

output:

BLACK

result:

ok single line: 'BLACK'

Test #16:

score: 0
Accepted
time: 2ms
memory: 1768kb

input:

2 8916
STARE YYGGY
FISHY --Y--
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS
ACARI
ACERB
ACETA
ACHED...

output:

TEARS

result:

ok single line: 'TEARS'

Test #17:

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

input:

1 1
HELLO GGGGG
HELLO

output:

HELLO

result:

ok single line: 'HELLO'

Test #18:

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

input:

5 8916
SPLAT -----
CARES -----
TENIA --GY-
LIROT -G---
STELA -----
SPLAT
CARES
TENIA
LIROT
STELA
DINGY
THERM
BORTS
SNARL
SATED
ANGER
CELTS
PLAIN
PUCES
SOKES
EDIFY
FRITT
ACIDS
CUSSO
RECUR
MENAD
JORAM
GORSE
TRULL
HOWES
FATLY
TALON
MOLAR
CARTS
BEGAN
BAFFS
CULMS
KLIKS
NIPAS
ODIST
MIZEN
AGAIN
IDYLL
BONDS...

output:

DINGY
FINNY
WINGY
JINNI
DINKY
GINNY
MINNY
NINNY
WINDY
KINKY
ZINGY
BINDI
MINGY
HINKY
HINNY
ZINKY

result:

ok 16 lines

Test #19:

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

input:

5 8916
PULER -GG--
GRABS G----
TREND -----
NEMAS -----
ANNUL ---YY
PULER
GRABS
TREND
NEMAS
ANNUL
GULCH
CAGEY
RERUN
TABOO
LIVID
RIFFS
KALES
SALAD
RELET
POOHS
WENCH
PUTTO
CALMS
LYARD
SPOON
FUSIL
GRIFF
MONGO
LEZZY
QUATE
BOOMS
KNISH
JEHUS
SOILS
MACES
BELON
MOLTS
TWYER
COZEN
GAVOT
REEFS
HYDRO
ASKEW
DATES...

output:

GULCH
GULLY
GULFY

result:

ok 3 lines

Test #20:

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

input:

2 8916
JURAT --GY-
CURIE G-G-Y
JURAT
CURIE
CAREX
BIBBS
PALEA
OPERA
RAJAH
EMERY
CREEL
OSTIA
REVET
ROWDY
SPRIG
AZUKI
CHASM
FOAMY
PRIES
BELCH
LINKY
DRUBS
INFIX
TUBBY
FIQUE
MEDIA
SOAVE
EIDOS
STEWS
USQUE
UREAS
CHAYS
ISLED
RAKEE
LAHAR
SWART
CUBER
KEVEL
LIFTS
SPAHI
SWARD
SLICK
PUNTS
YOKES
CORIA
VISIT
SAYER...

output:

CAREX
CARER
CARED
CARES

result:

ok 4 lines

Test #21:

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

input:

4 8916
CHUCK -----
GRANS -----
KARMA -----
TEGUA -G---
CHUCK
GRANS
KARMA
TEGUA
DELLY
DOATS
OUZOS
SOPHY
DREED
WHIST
KEIRS
PENAL
GASPS
DRIES
ROMAN
FROTH
SHALT
LOOPS
PRAUS
HARPY
ANNOY
LUTES
BLARE
SOPOR
PAINS
APEAK
DEVIL
RECTI
VALUE
MINTY
DYING
WIMPS
JATOS
WALLA
ZLOTY
POSER
FOEHN
CACTI
SHOJI
UNIFY
GEOID...

output:

DELLY
DEVIL
BEVEL
FEDEX
VEXED
BEEDI
JELLO
DEWED
VEXIL
FEYLY
WEDEL
PEPPY
WEEPY
WEBBY
LEVEL
BELIE
JELLY
BEZEL
BEBOP
BELLY
WELLY
DELED
BEDEW
PEWEE
DEVEL
DEIFY
BEZIL
JEWEL
FEEZE
DELVE
PEEVE
BELOW
BEEFY
DEBYE
WEEDY
FELID
FEOFF
DEOXY
DEXIE
LEVEE
LEZZY
JEBEL
DEEDY
BELLE
FEZZY
BEDEL
FELLY

result:

ok 47 lines

Test #22:

score: 0
Accepted
time: 3ms
memory: 1708kb

input:

6 8916
IVORY Y---G
JIFFS -Y-G-
GURRY -Y--G
DONGS --Y--
CHIAO --G--
POXES -----
IVORY
JIFFS
GURRY
DONGS
CHIAO
POXES
UNIFY
SMEEK
RAWER
MONAD
MARLS
PIRNS
WHACK
STALL
LILAC
CACTI
GRAPH
TACES
CHIEL
LEHRS
URSID
CURSE
GRIPE
PRISM
TRYMA
HEATH
HARES
ABLER
BIGOS
POSSE
FORTE
IRONE
SWAMP
KINKY
WARDS
BYSSI
POCKY...

output:

UNIFY

result:

ok single line: 'UNIFY'

Test #23:

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

input:

10 8916
BLOGS YG--G
ZEBRA --G-Y
SHIEL Y---Y
SONSY Y----
KELLY --Y--
YOURS ----G
SORRY Y----
DOCKS ----G
DYNES ----G
MAXIS -Y--G
BLOGS
ZEBRA
SHIEL
SONSY
KELLY
YOURS
SORRY
DOCKS
DYNES
MAXIS
ALBAS
ANILE
LIANE
CHOOK
HEXER
PALER
GENET
CULPA
HELVE
PAGED
OAKEN
PATCH
GAUMS
NOLOS
NABES
JOIST
FERES
ARDEB
SWOR...

output:

ALBAS

result:

ok single line: 'ALBAS'