QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#360510#6785. What Kind of Friends Are You?matongc233AC ✓17ms4896kbC++141.9kb2024-03-21 20:45:152024-03-21 20:45:17

Judging History

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

  • [2024-03-21 20:45:17]
  • 评测
  • 测评结果:AC
  • 用时:17ms
  • 内存:4896kb
  • [2024-03-21 20:45:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 100010, MOD = 1e9 + 7;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;
typedef queue<PII> QPII;
typedef stack<int> SI;
typedef vector<PII> VPII;
typedef deque<int> DPII;
typedef queue<int> QI;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
unordered_map<string, int> ump;
int t, n, q, c;

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> t;

    string a[210];
    while (t--)
    {
        cin >> n >> q;
        cin >> c;
        int s[210][25] = {0};
        for (int i = 1; i <= c; i++)
        {
            cin >> a[i];
            ump[a[i]] = i;
        }
        for (int i = 0; i < q; i++)
        {
            int k;
            cin >> k;
            while(k--)
            {
                string op;
                cin >> op;
                s[ump[op]][i] = 1;
            }
        }
        int p[210] = {0};
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < q; j++)
            {
                int w;
                cin >> w;
                p[i] += w*(1 << j);
            }
        }
        int u[210] = {0};
        for (int i = 1; i <= c;i++){
            for (int j = 0; j < q;j++){
                u[i] += s[i][j]*(1 << j) ;
            }
        }
        for (int i = 0; i < n; i++)
        {
            int cnt = 0;
            string res;
            for (int j = 1; j <= c; j++)
            {
                if (p[i] == u[j])
                {
                    cnt++;
                    res = a[j];
                }
            }
            if (cnt == 1)
            {
                cout << res << '\n';
            }
            else{
                cout << "Let's go to the library!!" << '\n';
            }
        }
    }
    
    

    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
3 4
5 Serval Raccoon Fennec Alpaca Moose
4 Serval Raccoon Alpaca Moose
1 Serval
1 Fennec
1 Serval
1 1 0 1
0 0 0 0
1 0 0 0
5 5
11 A B C D E F G H I J K
3 A B K
4 A B D E
5 A B K D E
10 A B K D E F G H I J
4 B D E K
0 0 1 1 1
1 0 1 0 1
1 1 1 1 1
0 0 1 0 1
1 0 1 1 1

output:

Serval
Let's go to the library!!
Let's go to the library!!
Let's go to the library!!
Let's go to the library!!
B
Let's go to the library!!
K

result:

ok 8 lines

Test #2:

score: 0
Accepted
time: 17ms
memory: 4896kb

input:

100
98 16
154 rliLiumEVQKkJNnMjAj qnhiLgzjsjRsu eiHrssJvVWBLaRFMQVo TwLVZsRNyEOysXY JtYpguJiCihuObMygLVt YiquXjVeDoe pSkLcJbceYhjx vrVgRvYziqmEpVJdB OYLIFEnoKsDXLtEpyRIF EKTKIOpwEswTWgvihdCa MCCudkhYJC wOkSGOgjZlWgf hTcqiMZqeBCjOmzAt dPWGKzHa iDWjhWBQsoQCInigoNIf qGXWZvcWVJvGUbZ oRLdhU NecdjCwFAikYe...

output:

Let's go to the library!!
Let's go to the library!!
Let's go to the library!!
Let's go to the library!!
Let's go to the library!!
Let's go to the library!!
Let's go to the library!!
Let's go to the library!!
Let's go to the library!!
FJVBxEemjhzUqZxTjU
Let's go to the library!!
Let's go to the libra...

result:

ok 9542 lines