結果

問題 No.2178 Payable Magic Items
ユーザー FplusFplusFFplusFplusF
提出日時 2023-01-06 23:41:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,204 bytes
コンパイル時間 2,075 ms
コンパイル使用メモリ 213,788 KB
実行使用メモリ 20,268 KB
最終ジャッジ日時 2024-05-08 13:41:35
合計ジャッジ時間 13,166 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 5 ms
5,376 KB
testcase_19 AC 50 ms
7,936 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 5 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 WA -
testcase_25 AC 196 ms
5,888 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i,n) for (int i=0;i<(long long)(n);i++)
#define all(v) v.begin(),v.end()
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
const ll INF=(1ll<<60);
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
int main(){
    ll n,k;
    cin >> n >> k;
    vector<vector<char>> s(n,vector<char>(k));
    rep(i,n){
        rep(j,k){
            cin >> s[i][j];
        }
    }
    set<ll> ans;
    rep(i,n){
        for(ll j=i+1;j<n;j++){
            if(5e4<=n){
                if(i+100<j) break;
            }
            if(ans.count(i)) break;
            if(ans.count(j)) continue;
            bool a=true,b=true;
            rep(l,k){
                if(s[j][l]<s[i][l]){
                    a=false;
                }
                if(s[i][l]<s[j][l]){
                    b=false;
                }
            }
            if(a) ans.insert(i);
            if(b) ans.insert(j);
        }
    }
    cout << ans.size() << endl;
    return 0;
}
0