結果

問題 No.2178 Payable Magic Items
ユーザー 沙耶花
提出日時 2023-01-06 21:40:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 885 bytes
コンパイル時間 3,639 ms
コンパイル使用メモリ 254,524 KB
最終ジャッジ日時 2025-02-09 23:45:58
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

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