首页 > 小美的排列询问
头像 keduoli
发表于 2023-08-20 21:49:31
前言 人工智能究竟能不能拥有和人一样的“爱”。 看完这本书的我觉得,这种爱,人工智能不应该去渴求拥有。 整体评价 原题场吧,开赛前就直言不讳说是来自美团的笔试题。 整体还是简单,D这个树形DP不错,可能有段时间没写树形DP题。 A. 小美的排列询问 简单题,线性遍历即可。 import jav 展开全文
头像 StanMarsh
发表于 2023-08-20 23:03:15
from functools import lru_cache from math import sqrt @lru_cache(None) def dfs(u, parent, b): """ param: b: 当前节点是否已经染色 """ re 展开全文
头像 牛客664857134号
发表于 2023-08-21 11:41:04
A题解 | #小美的排列询问#扫描一遍数组,判断a[i-1]和a[i]是否为x,y或y,x #include <cstdio> #include <cstring> #include <algorithm> #include <map> #includ 展开全文
头像 龍眠
发表于 2025-05-07 10:01:20
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); 展开全文
头像 牛客115262840号
发表于 2025-05-28 14:41:51
n = int(input()) arr = list(map(int,input().split())) x,y = map(int,input().split()) if x not in arr or y not in arr: print('No') if arr[arr.index 展开全文
头像 可爱的菜鸡正在卷
发表于 2025-05-07 19:41:26
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; vector<int> a(n); for(int i=0;i<n;i++){ 展开全文
头像 叫啥名
发表于 2025-05-07 21:47:46
// #牛客春招刷题训练营# https://www.nowcoder.com/discuss/726480854079250432 #include <iostream> #include <algorithm> #include <vector> using 展开全文
头像 不要为打翻的牛奶哭泣
发表于 2025-05-08 16:57:07
小美的排列询问#扫描一遍数组,判断a[i-1]和a[i]是否为x,y或y,x #include <cstdio> #include <cstring> #include <algorithm> #include <map> #include <u 展开全文
头像 剑绝尘
发表于 2025-05-08 20:44:58
#include <bits/stdc++.h> using namespace std; //扫一遍数组,看看x是否在y的前一个,或者y在x的前一个就行了 const int N = 200001; int n,a[N],x,y; int main(){ cin>& 展开全文
头像 炸天帮李白
发表于 2023-08-20 20:46:41
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5 + 10; int t; int n; int a[N]; void solve(int cases) { cin 展开全文

等你来战

查看全部