LOADING

加载过慢请开启缓存,浏览器默认开启

Waiting for the dawn

daily 1

2023/10/8
阅读全文

daily 2

2023/10/7
阅读全文

daily 1

2023/10/6
阅读全文

daily 2

2023/10/5
阅读全文

daily 1

2023/10/4
阅读全文

daily 1

2023/10/3

CF 99A

阅读全文

daily 2

2023/10/2

daily codeforces

阅读全文

daily 1

2023/9/29

CF 80A

#include<iostream>


#include<algorithm>


using namespace std;


int prime[17]={-1,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53},n,m;


int main(){


    cin>>n>>m;


    if(*upper_bound(prime,prime+17,m)==n || *upper_bound(prime,prime+17,m)==n) cout<<"YES";


    else cout<<"NO\n";


    return 0;


}
阅读全文

daily 2

2023/9/25

CF 1609D

#define int ll
int deg[MAXN];
struct edge {
  int u, v;
};
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n + 1);
  int r = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    r = max(r, a[i]);
  } 
  vector<edge> E;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    E.push_back({u, v});
  }
  function<bool(int)> check = [&] (int mid) {
    for (int i = 1; i <= n; ++i) deg[i] = 0;
    vector<vector<int>> ED(n + 1);
    for (auto& e : E) {
      if (a[e.u] <= mid && a[e.v] <= mid) {
        ED[e.u].push_back(e.v);
        deg[e.v]++;
      }
    }
    queue<int> q;
    vector<int> dp(n + 1);
    for (int i = 1; i <= n; ++i) {
      if (!deg[i]) {
        q.push(i);
        dp[i] = 1;
      }
    }
    while (!q.empty()) {
      auto u = q.front();
      q.pop();
      for (int &v : ED[u]) {
        deg[v]--;
        if (!deg[v]) {
          q.push(v);
        }
        dp[v] = max(dp[u] + 1, dp[v]);
      } 
    }
    for (int i = 1; i <= n; ++i) {
      if (deg[i]) {
        return true;
      }
    }
    return *max_element(dp.begin() + 1, dp.end()) >= k;
  };
  int l = 0, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (k == 1) {
    ans = *min_element(a.begin() + 1, a.end());
  }
  cout << ans << '\n';
  return ;
}
阅读全文

daily 1

2023/9/21
阅读全文
1 ... 6 7 8 9 10 ... 30
avatar
Yanxin Xiang

愿有一天能和你最重要的人再次相逢