QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#529176#9221. Missing Boundariesucup-team2894#Compile Error//Python31.6kb2024-08-24 10:19:132024-08-24 10:19:14

Judging History

你现在查看的是最新测评结果

  • [2024-08-24 10:19:14]
  • 评测
  • [2024-08-24 10:19:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
 
using ll = long long;
const int inf = 1e9 + 100;
const ll linf = 1e18 + 100;
using vi = vector<int>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
 
mt19937 rnd(time(0));
 
#define TIME (clock() * 1. / CLOCKS_PER_SEC)
 
using ld = double;
const ld PI = acosl(-1.L);
 
const int maxn = 1e6+10;
// const ll mod = 998244353;


void solvee() {
  vector<pii> v;
  int ex = 0;
  int n,l;
  cin >> n >> l;
  for(int i=0;i<n;i++){
    int l,r;
    cin >> l >> r;
    if(l==-1&&r==-1)ex++;
    else v.push_back({l,r});
  }
  auto getval = [&](auto p){
    if(p.first!=-1) return p.first;
    return p.second;
  };
  sort(all(v),[&](auto a,auto b){return getval(a)<getval(b);});
  for(int i=0;i+1<v.size();i++)if(getval(v[i])==getval(v[i+1])){
    cout << "NIE\n";
    return;
  }
  if(ex>l-(int)v.size()){
    cout << "NIE\n";
    return;
  }
  int req = 0;
  int cur = 0;
  bool ch = false;
  for(auto [l,r] : v) {
    if(l!=-1){
      if(!ch&&cur!=l-1)req++;
      if(r!=-1){
        cur = r;
        ch = false;
      }
      else {
        cur = l;
        ch = true;
      }
    }
    else {
      cur = r;
      ch = false;
    }
  }
  if(cur!=l&&!ch)req++;
  if(ex>=req) cout << "TAK\n";
  else cout << "NIE\n";
}
 
void solve() {
  int tc = 1;
  cin >> tc;
  while(tc--){
    solvee();
  }
}
 
signed main() {
	// cin.tie(0)->sync_with_stdio(0);
	// cin.exceptions(cin.failbit);
	cout << fixed;
	cout.precision(9);
  solve();
}

Details

  File "answer.code", line 20
    const ld PI = acosl(-1.L);
                          ^
SyntaxError: invalid decimal literal