提出 #73386333
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
template<typename T> using vc = vector<T>;
template<typename T> using vv = vc<vc<T>>;
//-------------1.型系---------------
using ll = long long;
using ull = unsigned long long;
ll INF = 3e18;
double pi = 3.14159265358979;
using ld = long double;
using bl = bool;
using mint = modint998244353;
//using mint = modint1000000007;
//using mint = modint;//使うときはコメントアウトを外す
//mint::set_mod(m);//使うときはコメントアウトを外す
template<class T> using pq = priority_queue<T, vc<T>>;//大きい順
template<class T> using pq_g = priority_queue<T, vc<T>, greater<T>>;//小さい順
//-----------------------------------
//-------------2.配列系--------------
using vl = vc<ll>; using vvl = vv<ll>; using vvvl = vv<vl>; using vvvvl = vv<vvl>;
using vs = vc<string>; using vvs = vv<string>; using vvvs = vv<vs>;
using vb = vc<bl>; using vvb = vv<bl>; using vvvb = vv<vb>;
using vld = vc<ld>; using vvld = vv<ld>; using vvvld = vv<vld>;
using pll = pair<ll, ll>;
using vmint = vc<mint>; using vvmint = vv<mint>; using vvvmint = vv<vmint>; using vvvvmint = vv<vvmint>;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
template<class T>istream& operator>>(istream& i, vc<T>& v) { rep(j, size(v))i >> v[j]; return i; }
using ar2 = array<ll, 2>;
//----------------------------------
//--------3.コード短縮化とか---------
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pb push_back
#define eb emplace_back
#define em emplace
#define pob pop_back
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define YN {cout<<"Yes\n";}else{cout<<"No\n";}// if(a==b)YN;
#define vc_unique(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define vc_rotate(v) rotate(v.begin(),v.begin()+1,v.end());
#define pop_cnt(s) ll(popcount(uint64_t(s)))
#define next_p(v) next_permutation(v.begin(),v.end())
ll nc2(ll x) { return x * (x - 1) / 2; }
ll nc3(ll x) { return x * (x - 1) * (x - 2) / 6; }
#define yu_qurid(x,y) ((x)*(x)+(y)*(y))//ユークリッド距離 sqrtはしてないなので注意
#define mannhattan(x1,x2,y1,y2) (abs(x1-x2)+abs(y1-y2)) // マンハッタン距離 = |x1-x2|+|y1-y2|
//if (regex_match(s, regex("")))YN;//文字列sの判定を行う。コメントアウトを外して「""」の中に判定する内容を入れる
//-------------------------------
//---------4.グリッド系----------
vl dx = { 1,0,-1,0 };
//vl dx={1,1,0,-1,-1,-1,0,1};
vl dy = { 0,1,0,-1 };
//vl dy={0,1,1,1,0,-1,-1,-1};
bool out_grid(ll i, ll j, ll h, ll w) {//trueならcontinue
return (!(0 <= i && i < h && 0 <= j && j < w));
}
#define vvl_kaiten(v) {ll n = size(v);vvl nx(n,vl(n));rep(i,n)rep(j,n)nx[j][n-i-1]=v[i][j];swap(nx,v);}//時計回りに90°回転
//#define vvl_kaiten(v) {ll n = size(v);vvl nx(n,vl(n));rep(i,n)rep(j,n)nx[n-j-1][i]=v[i][j];swap(nx,v);}//反時計周りに90°回転
#define vs_kaiten(v) {ll n = size(v);vs nx(n,string(n,'.'));rep(i,n)rep(j,n)nx[j][n-i-1]=v[i][j];swap(nx,v);}//文字列版 時計回りに90°回転
//#define vs_kaiten(v) {ll n = size(v);vs nx(n,string(n,'.'));rep(i,n)rep(j,n)nx[n-j-1][i]=v[i][j];swap(nx,v);}//文字列版 反時計周りに90°回転
#define vvl_tenti(v) {ll n = size(v);vvl nx(n,vl(n));rep(i,n)rep(j,n)nx[j][i]=v[i][j];swap(nx,v);}
#define vs_tenti(v) {ll n = size(v); vs nx(n, string(n,'.')); rep(i, n)rep(j, n)nx[j][i] = v[i][j]; swap(nx, v);}
//回転、転置はn*nしか使えないことに注意
//--------------------------------
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
ll n, k;
cin >> n >> k;
vl m(n);
vvs s(n);
vc<set<string>> st(n);
rep(i, n){
cin >> m[i];
vs now(m[i]);
rep(j, m[i]) cin >> now[j], st[i].insert(now[j]);
s[i]=now;
}
ll ans=0;
rep(i, n)rep(j, i){
ll cnt=0;
rep(k, m[i]){
if(st[j].count(s[i][k])) cnt++;
}
ans+=cnt>=k;
}
cout << ans << endl;
}
提出情報
| 提出日時 |
|
| 問題 |
B - 共同研究できる研究室 |
| ユーザ |
Gakugakuta |
| 言語 |
C++23 (GCC 15.2.0) |
| 得点 |
266 |
| コード長 |
4463 Byte |
| 結果 |
AC |
| 実行時間 |
396 ms |
| メモリ |
8252 KiB |
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
266 / 266 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
sample01.txt, sample02.txt, sample03.txt |
| All |
sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in40.txt, in41.txt, in42.txt, in43.txt, in44.txt, in45.txt, in46.txt, in47.txt, in48.txt, in49.txt, in50.txt, in51.txt, in52.txt, in53.txt, in54.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| in01.txt |
AC |
1 ms |
3628 KiB |
| in02.txt |
AC |
1 ms |
3584 KiB |
| in03.txt |
AC |
1 ms |
3628 KiB |
| in04.txt |
AC |
177 ms |
5592 KiB |
| in05.txt |
AC |
101 ms |
5420 KiB |
| in06.txt |
AC |
2 ms |
3532 KiB |
| in07.txt |
AC |
228 ms |
8196 KiB |
| in08.txt |
AC |
230 ms |
8104 KiB |
| in09.txt |
AC |
386 ms |
8112 KiB |
| in10.txt |
AC |
386 ms |
8248 KiB |
| in11.txt |
AC |
388 ms |
8168 KiB |
| in12.txt |
AC |
362 ms |
8168 KiB |
| in13.txt |
AC |
386 ms |
8104 KiB |
| in14.txt |
AC |
1 ms |
3608 KiB |
| in15.txt |
AC |
1 ms |
3552 KiB |
| in16.txt |
AC |
1 ms |
3576 KiB |
| in17.txt |
AC |
1 ms |
3604 KiB |
| in18.txt |
AC |
1 ms |
3560 KiB |
| in19.txt |
AC |
1 ms |
3644 KiB |
| in20.txt |
AC |
1 ms |
3604 KiB |
| in21.txt |
AC |
1 ms |
3604 KiB |
| in22.txt |
AC |
1 ms |
3604 KiB |
| in23.txt |
AC |
386 ms |
8200 KiB |
| in24.txt |
AC |
396 ms |
8252 KiB |
| in25.txt |
AC |
129 ms |
8252 KiB |
| in26.txt |
AC |
158 ms |
8252 KiB |
| in27.txt |
AC |
369 ms |
6248 KiB |
| in28.txt |
AC |
369 ms |
6096 KiB |
| in29.txt |
AC |
372 ms |
6176 KiB |
| in30.txt |
AC |
371 ms |
6104 KiB |
| in31.txt |
AC |
394 ms |
8216 KiB |
| in32.txt |
AC |
393 ms |
8200 KiB |
| in33.txt |
AC |
363 ms |
6160 KiB |
| in34.txt |
AC |
243 ms |
5644 KiB |
| in35.txt |
AC |
380 ms |
7020 KiB |
| in36.txt |
AC |
381 ms |
7064 KiB |
| in37.txt |
AC |
391 ms |
8104 KiB |
| in38.txt |
AC |
391 ms |
8220 KiB |
| in39.txt |
AC |
181 ms |
5548 KiB |
| in40.txt |
AC |
115 ms |
4832 KiB |
| in41.txt |
AC |
60 ms |
4356 KiB |
| in42.txt |
AC |
82 ms |
4540 KiB |
| in43.txt |
AC |
1 ms |
3608 KiB |
| in44.txt |
AC |
1 ms |
3588 KiB |
| in45.txt |
AC |
1 ms |
3628 KiB |
| in46.txt |
AC |
1 ms |
3580 KiB |
| in47.txt |
AC |
1 ms |
3580 KiB |
| in48.txt |
AC |
1 ms |
3644 KiB |
| in49.txt |
AC |
1 ms |
3560 KiB |
| in50.txt |
AC |
1 ms |
3592 KiB |
| in51.txt |
AC |
1 ms |
3592 KiB |
| in52.txt |
AC |
1 ms |
3588 KiB |
| in53.txt |
AC |
1 ms |
3496 KiB |
| in54.txt |
AC |
1 ms |
3448 KiB |
| sample01.txt |
AC |
1 ms |
3612 KiB |
| sample02.txt |
AC |
1 ms |
3588 KiB |
| sample03.txt |
AC |
1 ms |
3452 KiB |