记录详情

Accepted

/in/foo.cc: In function 'int read()':
/in/foo.cc:5:30: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
                       ~~~~~~~^~~~~~~
# 状态 耗时 内存占用
#1 Accepted 11ms 308.0 KiB
#2 Accepted 4ms 208.0 KiB
#3 Accepted 5ms 208.0 KiB
#4 Accepted 4ms 664.0 KiB
#5 Accepted 5ms 308.0 KiB
#6 Accepted 4ms 304.0 KiB
#7 Accepted 4ms 660.0 KiB
#8 Accepted 5ms 308.0 KiB
#9 Accepted 8ms 308.0 KiB
#10 Accepted 4ms 216.0 KiB
#11 Accepted 2ms 576.0 KiB
#12 Accepted 2ms 580.0 KiB
#13 Accepted 2ms 220.0 KiB

代码

#include <bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
	while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return f?x:-x;
}

int a[100020];

int allOne(int l, int r) {
  if (l < 1) return false;
  for (int i = l; i <= r; ++ i) {
    if (!a[i]) return false;
  }
  return true;
}

int main() {
  int n = read(), m = read(), k = read();

  for (int i = 1; i <= m; ++ i) {
    a[i] = 1;
  }
  for (int i = m+1; i <= 100000; ++ i) {
    for (int j = 1; j <= m; ++ j) {
      if (allOne(i-j-k, i-j-1)) {
        a[i] = 1;
        break;
      }
    }
  }

  for (int i = 1; i <= n; ++ i) {
    int x = read();
    if (!a[x]) return puts("No"), 0;
  }

  puts("Yes");
}

信息

递交者
类型
递交
题目
P1002 hitwh 2019 新生赛 C cqsss and his enterprise
语言
C++
递交时间
2020-12-17 09:20:51
评测时间
2020-12-17 09:20:51
评测机
分数
100
总耗时
66ms
峰值内存
664.0 KiB