AtCoder Regular Contest 070

Submission #1356339

Source codeソースコード

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

const int maxn = 810;
const int INF = 1<<30;

int f[maxn][maxn];
int l[maxn], r[maxn];

int main()
	int n;
	for (int i=1;i<=n;i++) scanf("%d%d",&l[i],&r[i]);
	for (int i=0;i<maxn;i++)
		for (int j=0;j<maxn;j++) f[i][j] = INF;
	for (int i=max(r[1]-l[1],1);i<maxn;i++) f[1][i] = abs(r[1] - i);
	for (int i=1;i<n;i++)
		for (int j=0;j<maxn;j++)
			for (int x=-maxn/2;x<maxn/2;x++)
				int newl = l[i+1] - x, newr = r[i+1] - x;
				if (newl <= 0) break;
				if (newl <= j) f[i+1][newr] = min(f[i+1][newr], f[i][j] + abs(x));
				//cout<<i<<" "<<i+1<<" "<<j<<" "<<x<<" "<<newr<<" "<<f[i][j]+abs(x)<<" "<<f[i+1][newr]<<endl;
	int ans = INF;
	for (int i=0;i<maxn;i++) ans = min(ans,f[n][i]);
	return 0;


Task問題 E - NarrowRectangles
User nameユーザ名 Gabriel
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 RE
Score得点 0
Source lengthソースコード長 968 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:18:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:19:50: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for (int i=1;i<=n;i++) scanf("%d%d",&l[i],&r[i]);

Test case


Set name Score得点 / Max score Cases
Sample - 0_000.txt,0_001.txt,0_002.txt,0_003.txt,0_004.txt
Subtask 0 / 300 0_000,0_001,0_004,1_005.txt,1_006.txt,1_007.txt,1_008.txt,1_009.txt,1_010.txt,1_011.txt,1_012.txt,1_013.txt,1_014.txt,1_015.txt,1_016.txt,1_017.txt
All 0 / 700 0_000.txt,0_001.txt,0_002.txt,0_003.txt,0_004.txt,1_005.txt,1_006.txt,1_007.txt,1_008.txt,1_009.txt,1_010.txt,1_011.txt,1_012.txt,1_013.txt,1_014.txt,1_015.txt,1_016.txt,1_017.txt,2_018.txt,2_019.txt,2_020.txt,2_021.txt,2_022.txt,2_023.txt,2_024.txt,2_025.txt,2_026.txt,2_027.txt,2_028.txt,2_029.txt,2_030.txt,2_031.txt,2_032.txt,2_033.txt,2_034.txt,2_035.txt,2_036.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_000.txt AC 4 ms 2816 KB
0_001.txt AC 4 ms 2816 KB
0_002.txt WA
0_003.txt RE
0_004.txt AC 3 ms 2816 KB
1_005.txt AC 312 ms 2816 KB
1_006.txt AC 312 ms 2816 KB
1_007.txt AC 232 ms 2816 KB
1_008.txt WA
1_009.txt WA
1_010.txt WA
1_011.txt WA
1_012.txt WA
1_013.txt WA
1_014.txt WA
1_015.txt WA
1_016.txt WA
1_017.txt WA
2_018.txt RE
2_019.txt RE
2_020.txt TLE
2_021.txt TLE
2_022.txt TLE
2_023.txt TLE
2_024.txt TLE
2_025.txt TLE
2_026.txt TLE
2_027.txt TLE
2_028.txt TLE
2_029.txt TLE
2_030.txt TLE
2_031.txt TLE
2_032.txt TLE
2_033.txt TLE
2_034.txt TLE
2_035.txt TLE
2_036.txt TLE