結果

問題 No.2178 Payable Magic Items
ユーザー 沙耶花沙耶花
提出日時 2023-01-06 21:40:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 885 bytes
コンパイル時間 4,259 ms
コンパイル使用メモリ 262,392 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-08-21 08:13:12
合計ジャッジ時間 10,160 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 2000000000000000005

int check(string &a,string &b){
	bool f0 = true,f1 = true;
	rep(i,a.size()){
		if(a[i]<b[i])f0 = false;
		if(a[i]>b[i])f1 = false;
	}
	if(f0)return 1;
	if(f1)return -1;
	return 0;
}

int main(){
	
	int N,K;
	cin>>N>>K;
	
	vector<string> ans;
	rep(i,N){
		string t;
		cin>>t;
		//rep(j,K)scanf("%d",&t[j]);
		bool f = true;
		rep(j,ans.size()){
			if(ans[j]==t)f = false;
		}
		if(!f)continue;
		{
			vector<string> na;
			rep(j,ans.size()){
				if(check(t,ans[j])==1)continue;
				na.push_back(ans[j]);
				if(check(t,ans[j])==-1)f = false;
			}
			if(f)na.push_back(t);
			swap(ans,na);
		}
	}
	cout<<N-ans.size()<<endl;
			
	
    return 0;
}
0