编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#66864 | #1264. 视频质量 | Compile Error | 0 | 0 ms | 0 K | C++ 17 / 1.5 K | 嘉心糖 | 2022-03-25 12:11:24 |
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;
ll yet[ll(1e13)];
int main() {
ll N, M;
scanf("%ld %ld", &N, &M);
ll *NP, *MP;
NP = (ll *)malloc(N * sizeof(ll));
MP = (ll *)malloc(N * sizeof(ll));
for (ll i = 0; i < N; i++) {
scanf("%ld %ld", &NP[i], &MP[i]);
}
ll f1(ll * NP, ll * MP, ll N, ll M);
ll ans = f1(NP, MP, N, M);
ll f2(ll * NP, ll * MP, ll N, ll M);
ll ans2 = f2(NP, MP, N, M);
printf("%ld %ld", ans, ans2);
return 0;
}
ll find(ll *NP, ll *MP, ll right, ll N, ll M) {
ll rightedge;
for (ll k = 0; k <= N; k++) {
for (ll i = 0; i <= right; i++) {
if (NP[k] == i) {
if (rightedge < MP[k])
rightedge = MP[k];
}
}
}
return rightedge;
}
ll f1(ll *NP, ll *MP, ll N, ll M) {
ll right = 0;
for (ll i = 0; i < N; i++) {
if (NP[i] == 0) {
if (MP[i] > right)
right = MP[i];
}
}
ll count = 1, temp;
temp = find(NP, MP, right, N, M);
while (1) {
if (temp == M) {
count++;
break;
}
temp = find(NP, MP, temp, N, M);
count++;
}
return count;
}
ll f2(ll *NP, ll *MP, ll N, ll M) {
ll minnum = ll(1e10);
for (ll i = 0; i < M; i++) {
for (ll j = 0; j < N; j++) {
if (i >= NP[j] && i < MP[j])
yet[i]++;
}
if (yet[i] < minnum)
minnum = yet[i];
}
return N - minnum + 1;
}
编译信息
/sandbox/1/a.cpp:4:8: warning: unsigned conversion from 'll' {aka 'long long int'} to 'unsigned int' changes value from '10000000000000' to '1316134912' [-Woverflow]
ll yet[ll(1e13)];
^~~~~~~~
/sandbox/1/a.cpp:4:16: error: size of array 'yet' is too large
ll yet[ll(1e13)];
^
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:8:11: warning: format '%ld' expects argument of type 'long int*', but argument 2 has type 'll*' {aka 'long long int*'} [-Wformat=]
scanf("%ld %ld",&N,&M);
^~~~~~~~~ ~~
/sandbox/1/a.cpp:8:11: warning: format '%ld' expects argument of type 'long int*', but argument 3 has type 'll*' {aka 'long long int*'} [-Wformat=]
/sandbox/1/a.cpp:14:15: warning: format '%ld' expects argument of type 'long int*', but argument 2 has type 'll*' {aka 'long long int*'} [-Wformat=]
scanf("%ld %ld",&NP[i],&MP[i]);
^~~~~~~~~ ~~~~~~
/sandbox/1/a.cpp:14:15: warning: format '%ld' expects argument of type 'long int*', but argument 3 has type 'll*' {aka 'long long int*'} [-Wformat=]
/sandbox/1/a.cpp:20:12: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'll' {aka 'long long int'} [-Wformat=]
printf("%ld %ld",ans,ans2);
^~~~~~~~~ ~~~
/sandbox/1/a.cpp:20:12: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'll' {aka 'long long int'} [-Wformat=]
/sandbox/1/a.cpp: In function 'll f2(ll*, ll*, ll, ll)':
/sandbox/1/a.cpp:70:17: error: 'yet' was not declared in this scope
yet[i]++;
^~~
/sandbox/1/a.cpp:70:17: note: suggested alternative: 'getw'
yet[i]++;
^~~
getw
/sandbox/1/a.cpp:72:12: error: 'yet' was not declared in this scope
if(yet[i]<minnum)
^~~
/sandbox/1/a.cpp:72:12: note: suggested alternative: 'getw'
if(yet[i]<minnum)
^~~
getw
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%ld %ld",&N,&M);
~~~~~^~~~~~~~~~~~~~~~~
/sandbox/1/a.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%ld %ld",&NP[i],&MP[i]);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~