#include<stdio.h> int main(){ int num[1000]={0}; int n,m,x,y; scanf("%d",&n); while(n--){ int max=0; int sum[1000]={0}; scanf("%d",&m); for(x=0;x<m;x++){ scanf("%d",&num[x]); } for(x=m;x>=0;x--){ for(y…
#include <cstdio> #include <iostream> #include <cstring> using namespace std; const int INF = 0x3fffffff; int g[1005][1005]; int m; int Dijkstra(int s,int t) { bool visit[1005]; int dis[1005]; for(int i = 1; i <= m; ++i) { visit[i] =…
Dungeon Master Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20995 Accepted: 8150 Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled wit…
Fence Repair Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 32424 Accepted: 10417 Description Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) pla…
Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 36398 Accepted: 15554 Description You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a d…
#include <cstdio> #include <iostream> #include <cstring> using namespace std; const int INF = 0x3fffffff; int g[1005][1005]; int m; void Floyd() { int i, j, k; for (k=1;k<=m;k++) { for (i=1;i<=m;i++) { for (j=1;j<=m;j++) { if (g…