看不懂的代码
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long llint;
typedef pair< int, int > par;
#define x first
#define y second
class StringGame {
public:
int a[55][55];
int ch[55], dead[55];
vector <int> getWinningStrings( vector <string> S ) {
vector< int > ans;
int n = S.size();
for( int i = 0; i < n; ++i )
for( int j = 0; j < (int)S[i].size(); ++j )
a[i][S[i][j]-'a']++;
for( int i = 0; i < n; ++i ) {
for( int j = 0; j < 55; ++j )
ch[j] = dead[j] = 0;
bool okk = true;
for( int j = 0; j < 26; ++j ) {
int z = -1;
for( int k = 0; k < 26; ++k )
if( !ch[k] ) {
int ok = 1;
for( int l = 0; l < n; ++l )
if( !dead[l] && a[l][k] > a[i][k] ) { ok = 0; break; }
if( ok ) { z = k; break; }
}
if( z == -1 ) { okk = false; break; }
for( int l = 0; l < n; ++l )
if( a[l][z] < a[i][z] ) dead[l] = 1;
ch[z] = 1;
}
for( int l = 0; l < n; ++l )
if( l != i && !dead[l] ) okk = false;
if( okk ) ans.push_back( i );
}
return ans;
}
};
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long llint;
typedef pair< int, int > par;
#define x first
#define y second
class StringGame {
public:
int a[55][55];
int ch[55], dead[55];
vector <int> getWinningStrings( vector <string> S ) {
vector< int > ans;
int n = S.size();
for( int i = 0; i < n; ++i )
for( int j = 0; j < (int)S[i].size(); ++j )
a[i][S[i][j]-'a']++;
for( int i = 0; i < n; ++i ) {
for( int j = 0; j < 55; ++j )
ch[j] = dead[j] = 0;
bool okk = true;
for( int j = 0; j < 26; ++j ) {
int z = -1;
for( int k = 0; k < 26; ++k )
if( !ch[k] ) {
int ok = 1;
for( int l = 0; l < n; ++l )
if( !dead[l] && a[l][k] > a[i][k] ) { ok = 0; break; }
if( ok ) { z = k; break; }
}
if( z == -1 ) { okk = false; break; }
for( int l = 0; l < n; ++l )
if( a[l][z] < a[i][z] ) dead[l] = 1;
ch[z] = 1;
}
for( int l = 0; l < n; ++l )
if( l != i && !dead[l] ) okk = false;
if( okk ) ans.push_back( i );
}
return ans;
}
};