AtCoder Roulette
- #include<bits/stdc++.h>
- using namespace std;
- const int high = 205;
- int ar[high][high], ans[high], allC[high], mp[high][high];
- struct data {
- int indx;
- int c;
- }sarr[high];
- void sol(int N) {
- int C, clen=0;
- for(int i=0; i<N; i++) {
- cin >> C;
- allC[clen++] = C;
- for(int j=0; j<C; j++) {
- cin >> ar[i][j];
- }
- }
- int X, minC = 37, slen=0;
- cin >> X;
- for(int i=0; i<N; i++) {
- for(int j=0; j<allC[i]; j++) {
- if(ar[i][j] == X) {
- if(mp[i][j] == 0) {
- mp[i][j] = 1;
- sarr[slen].indx = i+1;
- sarr[slen++].c = allC[i];
- if(minC > allC[i]) {
- minC = allC[i];
- }
- }
- }
- }
- }
- //cout << "output:\n";
- //for(int i=0; i<slen; i++) {
- //cout << sarr[i].indx << " " << sarr[i].c << "\n";
- //}
- //cout << minC << "\n";
- int anslen = 0;
- for(int i=0; i<slen; i++) {
- if(sarr[i].c == minC) {
- ans[anslen++] = sarr[i].indx;
- }
- }
- cout << anslen << "\n";
- for(int i=0; i<anslen; i++) {
- cout << ans[i] << " ";
- }
- }
- int main() {
- int N;
- cin >> N;
- sol(N);
- return 0;
- }
Comments
Post a Comment