結果

問題 No.342 一番ワロタww
ユーザー mamekinmamekin
提出日時 2016-02-15 22:54:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,813 bytes
コンパイル時間 1,134 ms
コンパイル使用メモリ 103,512 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-05 16:13:38
合計ジャッジ時間 1,998 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    const vector<unsigned char> tmp = {0xEF, 0xBD, 0x97};

    vector<vector<unsigned char> > s;
    int len = 0;
    int maxLen = 0;
    for(;;){
        vector<unsigned char> v(1);
        if(!(cin >> v[0]))
            break;

        int n = 0;
        while(v[0] & (1 << (7 - n)))
            ++ n;
        n = max(n, 1);

        v.resize(n);
        for(int i=1; i<n; ++i)
            cin >> v[i];
        s.push_back(v);

        if(v == tmp){
            ++ len;
            if(len != s.size())
                maxLen = max(maxLen, len);
        }
        else{
            len = 0;
        }
    }

    if(maxLen == 0)
        return 0;

    vector<vector<vector<unsigned char> > > ans;
    int i = s.size() - 1;
    while(i >= 0){
        int j = i;
        while(j >= 0 && s[j] == tmp)
            -- j;

        int k = j;
        while(k >= 0 && s[k] != tmp)
            -- k;

        if(i - j == maxLen && j - k > 0){
            vector<vector<unsigned char> > v(s.begin() + 1 + k, s.begin() + 1 + j);
            ans.push_back(v);
        }
        i = k;
    }
    reverse(ans.begin(), ans.end());

    for(unsigned i=0; i<ans.size(); ++i){
        for(unsigned j=0; j<ans[i].size(); ++j){
            for(unsigned k=0; k<ans[i][j].size(); ++k){
                cout << ans[i][j][k];
            }
        }
        cout << endl;
    }

    return 0;
}
0