• 看不懂的代码


    #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;
      }
    };
  • 相关阅读:
    污点分析(taint analysis)综述 | 论文阅读 污点分析技术的原理和实践应用
    .NET中的泛型
    远控学习编写 gh0st
    OsmocomBB 摩托罗拉 c118 GSMSMS 嗅探
    CentOS8安装达梦数据库V8及使用方法
    CentOS8停止维护后,使用阿里源
    requests模块
    python 内存分析
    欧陆风云4此模组路径不可用
    C#中问号(?)用法总结
  • 原文地址:https://www.cnblogs.com/zhangdashuai/p/3702179.html
Copyright © 2020-2023  润新知