记录编号 |
593155 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[HZOI 2015] 偏序++ |
最终得分 |
100 |
用户昵称 |
┭┮﹏┭┮ |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
3.656 s |
提交时间 |
2024-08-23 21:12:07 |
内存使用 |
136.49 MiB |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define fi first
#define in inline
#define se second
#define mp make_pair
#define pb push_back
const int N = 4e4+10;
ll read(){
ll x = 0,f = 1;char c = getchar();
for(;c < '0' || c > '9';c = getchar())if(c == '-')f = -1;
for(;c >= '0' && c <= '9';c = getchar())x = (x<<1) + (x<<3) + c-'0';
return x * f;
}
int n,k;
bitset<N>s[N],ans;
pii a[N];
int main(){
freopen("partial_order_plus.in","r",stdin);
freopen("partial_order_plus.out","w",stdout);
n = read(),k = read();
for(int i = 1;i <= n;i++)s[i] = s[i-1],s[i][i] = 1;
for(int i = 1;i <= k;i++){
for(int i = 1;i <= n;i++)a[i].fi = read(),a[i].se = i;
sort(a+1,a+1+n);
ans.reset();
for(int i = 1;i <= n;i++){
s[a[i].se] &= ans;
ans[a[i].se] = 1;
}
}
ll ans = 0;
for(int i = 1;i <= n;i++)ans += (ll)s[i].count();
printf("%lld\n",ans);
return 0;
}