NOIP2023 T1逆天做法
  • 板块题目总版
  • 楼主HOILAI_CEO
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/11/21 18:29
  • 上次更新2023/11/21 22:53:41
查看原帖
NOIP2023 T1逆天做法
520847
HOILAI_CEO楼主2023/11/21 18:29

由于当时一心做T4,所以T1写成了这个:::

#include<iostream>
#include<vector>
#include <algorithm>

using namespace std;
const int maxn = 1e5;
int n, m;
string  dicts[maxn];
string res;
vector< vector<int> >dicts_all;
int isspecial[maxn];
bool cmp(int x, int y)
{
    return x < y;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n >> m;
    if (m == 1)
    {
        for (int i = 1; i <= n; i++)
        {
            cout << "0";
        }
    }
    for (int i = 1; i <= n; i++)
    {
        string temp = "0", _;
        cin >> _; temp.append(_);
        sort(temp.begin() + 1, temp.end(), cmp);
        dicts[i] = temp;
    }
    for (int i = 1; i <= n; i++)
    {
        string s = dicts[i];
        if (s[1] == 'a')
        {
            res.append("1");
        }
        else if (s[1] == 'z')
        {
            res.append("0");
        }
        else
        {
            if (((int)s[1]) < ((int)('k')))
            {
                res.append("1");
            }
            else
            {
                res.append("0");
            }

        }
    }
    cout << res;
    return 0;
}

2023/11/21 18:29
加载中...