cards
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
2025/03/12 optimize score-judge, detail at chinese description
Background
Alice and Bob is performing a "magic trick". First Alice will be given five cards randomly, with no repetition and jokers. Then she chooses four cards and show it to Bob in her desired order. After that Bob will need to tell what the remaining card is.
If you don't know, there are 4 suits and 13 values in the cards.
Suits: spade, heart, club, diamond
Values: A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K
Description
You will have to write two programs, one for Alice (program A) and one for Bob (program B). The two programs will be written in one file (See code template).
For example, Alice is given these five cards
- club K
- spade A
- heart 9
- spade 3
- diamond 3
Alice chooses a cards to hide to let Bob guess, let's say
- spade A
Then Alice will show Bob the other four cards at an order which Alice wants
- heart 9
- diamond 3
- club K
- spade 3
Bob will see these cards in the same order, and he has to tell which card Alice is hiding, in this case
- spade A
Format
The format of each card is <suit> <value>
e.g. club 8, heart Q
Every time when the program starts running, it receives a number
- If the number is
1, then it will run program A - If the number is
2, then it will run program B
See code template for reference
Input of program A
Five lines, one card per line.
Output of program A
Four lines, one card per line.
Input of program B
Same as Output of program A
Output of program B
One line with one card.
Sample
Input for Program A (from the judge)
club K
spade A
heart 9
spade 3
diamond 3
Output of program A
heart 9
diamond 3
club K
heart 9
Input for program B (Output of program A)
heart 9
diamond 3
club K
heart 9
Output of program B (which is the final answer)
spade A
Code Template
#include <bits/stdc++.h>
using namespace std;
// Variables, functions, structures, etc can be defined here
// But since program A and program B will be run separately,
// so values stored in variables will be lost.
void program_a() {
// code for program A
// for example
/*
int a;
cin >> a;
cout << "hello from program a " << a;
*/
}
void program_b() {
// code for program B
// for example
/*
int a, b;
cin >> a >> b;
cout << "hello from program b " << a + b;
*/
}
// main function
int main() {
int n;
cin >> n;
if (n == 1) program_a();
if (n == 2) program_b();
return 0;
}
Too lazy to write .py template.
2025-2026年度 PCOI 第二季
- Status
- Done
- Rule
- IOI
- Problem
- 9
- Start at
- 2026-2-28 14:30
- End at
- 2026-2-28 16:30
- Duration
- 2 hour(s)
- Host
- Partic.
- 41