LeetCode Weekly Contest 287 2問目 - Find Players With Zero or One Losses [2225]

Source

LeetCode Weekly Contest 287
問題文

問題概要

省略

解法

省略

cLay(version 20220312-1)のコード

C++に変換後のコードはこちら

#define main dummy_main
{}
#undef main

class Solution {
public:
  VVI findWinners(VVI& A) {
    VVI res(2);
    static int wn[1d5+1], ls[1d5+1];
    rep(i,1d5+1) wn[i] = ls[i] = 0;
    for(VI a : A) wn[a[0]]++, ls[a[1]]++;
    rep(i,1d5+1) if(wn[i]+ls[i]){
      if(ls[i]==0) res[0].push_back(i);
      if(ls[i]==1) res[1].push_back(i);
    }
    return res;
  }
};

Current time: 2024年05月06日04時47分13秒
Last modified: 2022年04月10日17時57分44秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る

Logged in as: unknown user (not login)

ログイン: