Why T2 WA 60pts?
  • 板块题目总版
  • 楼主lcfollower
  • 当前回复3
  • 已保存回复3
  • 发布时间2025/7/27 17:49
  • 上次更新2025/7/27 21:56:06
查看原帖
Why T2 WA 60pts?
1296826
lcfollower楼主2025/7/27 17:49
# include <bits/stdc++.h>

# define int long long
# define up(i ,x ,y) for (int i = x ; i <= y; i ++)
# define dn(i ,x ,y) for (int i = x ; i >= y ;i --)
# define inf 1e18

using namespace std;

inline int read(){int s = 0 , w = 0;char c = getchar();while(!isdigit(c)){w |= (c == '-');c = getchar();}while(isdigit(c)){s = (s << 1) + (s << 3) + (c ^ 48);c = getchar();}return w ? -s : s;}
inline void write(int x){if(x < 0) putchar('-') , x = -x;if(x > 9) write(x / 10);putchar(x % 10 | 48);}
inline void writesp(int x){write(x) , putchar(' ');}
inline void writeln(int x){write(x) , putchar('\n');}

const int N = 5e5 + 10;
int n ,m ,t ,a[N] ,sum[N];
bool vis[N];
inline int digit (int x){
  int res = 0;
  while (x) {res ++ ,x /= 10;}
  return res;
} signed main(){
  n = read () ,m = read ();
  up (i ,1 ,n) {
    a[i] = read ();
    if (i == 1) {vis[a[i]] = 1 ; t = digit (a[i]) ; continue;}
    if (vis[a[i]]) sum[a[i]] = t;
    else {
      vis[a[i]] = 1;
      sum[a[i]] = (t = t + digit (a[i]) + 1);
    } //writeln (t);
  } up (i ,1 ,m) writesp (sum[i]);
  return 0;
}
2025/7/27 17:49
加载中...