結果
| 問題 |
No.709 優勝可能性
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-11-30 16:00:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,616 bytes |
| コンパイル時間 | 1,963 ms |
| コンパイル使用メモリ | 176,236 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-06-26 23:40:25 |
| 合計ジャッジ時間 | 14,810 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | AC * 16 TLE * 1 -- * 5 |
ソースコード
#include "bits/stdc++.h" // {{{
using namespace std;
#define val const auto
#define eb emplace_back
#define emp emplace
#define fi first
#define se second
#define X first
#define Y second
#define outl(x) cout << (x) << '\n'
#define rep(i,n) for(int i=0; i < (int)(n); ++i)
#define ALL(x) begin(x), end(x)
#define TMPLT(T,U) template<class T, class U>
#define ten(p) ((long long)(1e##p))
#define FILL(a,v) memset((a), (v), sizeof(a))
#define FAST() ios::sync_with_stdio(false), cin.tie(nullptr)
#ifndef DEBUG
#define debug(...)
#define show(x)
#define show2(x,y)
#define LN()
#endif
#define def(op) inline bool operator op (const T &that) const { return comp(that) op 0; }
template<class T> struct Ordered {
virtual int comp(const T &that) const = 0;
def(==); def(!=); def(<); def(<=); def(>); def(>=); };
#undef def
typedef long long ll;
typedef pair<int,int> pii;
namespace ydk{
TMPLT(T,U) inline bool chmax(T &a, U b){return b>a ? a=b,1 : 0;}
TMPLT(T,U) inline bool chmin(T &a, U b){return b<a ? a=b,1 : 0;}
TMPLT(T,U) inline constexpr common_type_t<T,U> gcd(T x, U y)
{ return (x<y)? gcd(y,x) : (y <= 0)? x : gcd(y, x % y); }
TMPLT(T,U) inline constexpr ll lcm(T x, U y) { return (ll)x/gcd(x,y) * y; }
template<class Itr> string mkString(Itr begin, Itr end, const char *sp = " ") {
static ostringstream oss; oss.str(""); for(Itr i=begin; i != end; ++i) {
if(i != begin)oss << sp; oss << *i; } return oss.str(); }
constexpr int INF = 0x3f3f3f3f;
constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}
constexpr int MX = ten(5) + 10;
void Xx_main_xX(const int argc, char *argv[])
{
// first: id, second:value
int N, M;
vector<pii> buf[11];
int r;
cin >> N >> M;
rep(i, 10) buf[i].eb(0,0);
static int ans[MX];
int before = -1;
rep(i, N) {
rep(j, M) {
cin >> r;
if (r == buf[j].back().se) {
buf[j].eb(i, r);
before = -1;
}
else if (r > buf[j].back().se) {
buf[j].clear();
buf[j].eb(i, r);
before = -1;
}
}
if (before < 0) {
set<int> U;
rep(i, M) {
for(const pii& e : buf[i]) U.emp(e.fi);
}
before = U.size();
}
ans[i] = before;
}
rep(i, N) {
outl(ans[i]);
}
return;
}
} // {{{
signed main(int argc, char *argv[]){cout << fixed << setprecision(9); ydk::Xx_main_xX(argc, argv); return 0;} // }}}