214 条题解
-
0绿色的云 LV 10 @ 2013-04-29 13:35:54
VijosEx via JudgeDaemon2/13.4.6.0 via libjudge
编译成功测试数据 #0: Accepted, time = 27 ms, mem = 644 KiB, score = 10
测试数据 #1: Accepted, time = 1 ms, mem = 644 KiB, score = 10
测试数据 #2: Accepted, time = 5 ms, mem = 644 KiB, score = 10
测试数据 #3: Accepted, time = 5 ms, mem = 640 KiB, score = 10
测试数据 #4: Accepted, time = 31 ms, mem = 644 KiB, score = 10
测试数据 #5: Accepted, time = 3 ms, mem = 644 KiB, score = 10
测试数据 #6: Accepted, time = 5 ms, mem = 644 KiB, score = 10
测试数据 #7: Accepted, time = 4 ms, mem = 644 KiB, score = 10
测试数据 #8: Accepted, time = 3 ms, mem = 644 KiB, score = 10
测试数据 #9: Accepted, time = 3 ms, mem = 648 KiB, score = 10
Accepted, time = 94 ms, mem = 648 KiB, score = 100怎么回事,直接暴力。。。。。
#include <iostream>
#include <algorithm>#define MAXN 15000
using namespace std;
struct saver{
int x,y;
} a[MAXN];
int n;
int ans[MAXN];bool cmp(saver x, saver y){
if (x.x<y.x){
return true;
}
if (x.x>y.x){
return false;
}
return x.y<y.y;
}int main(){
cin>>n;
for (int i=0;i<n;i++){
cin>>a[i].x>>a[i].y;
ans[i]=0;
}
sort(a,a+n,cmp);
for (int i=0;i<n;i++){
int x=0;
for (int j=0;j<i;j++){
if (a[j].y<=a[i].y){
x++;
}
}
ans[x]++;
}
for (int i=0;i<n;i++){
cout<<ans[i]<<endl;
}
// system("pause");
return 0;
} -
02013-03-02 20:14:33@
测试数据 #0: Accepted, time = 46 ms, mem = 612 KiB, score = 10
测试数据 #1: Accepted, time = 46 ms, mem = 612 KiB, score = 10
测试数据 #2: Accepted, time = 31 ms, mem = 612 KiB, score = 10
测试数据 #3: Accepted, time = 46 ms, mem = 612 KiB, score = 10
测试数据 #4: Accepted, time = 390 ms, mem = 612 KiB, score = 10
测试数据 #5: Accepted, time = 31 ms, mem = 612 KiB, score = 10
测试数据 #6: Accepted, time = 31 ms, mem = 612 KiB, score = 10
测试数据 #7: Accepted, time = 31 ms, mem = 608 KiB, score = 10
测试数据 #8: Accepted, time = 46 ms, mem = 612 KiB, score = 10
测试数据 #9: Accepted, time = 15 ms, mem = 608 KiB, score = 10
Summary: Accepted, time = 713 ms, mem = 612 KiB, score = 100
var i,j,n,m,k,l,o,p:longint;
a,b,c:array[0..15000] of longint;
begin
readln(n);
for i:=1 to n do
readln(a[i],b[i]);for i:=1 to n do
begin
p:=0;
for j:=1 to n do
if (((a[i]>=a[j])and(b[i]>b[j]))or((b[i]>=b[j])and(a[i]>a[j])))and(i<>j) then p:=p+1;
c[p]:=c[p]+1;
end;
for i:=0 to n-1 do
writeln(c[i]);
end.请问为什么时间那么长
-
02013-02-16 10:18:43@
-
02012-10-30 21:11:28@
编译通过...
├ 测试数据 01:答案正确... (0ms, 696KB)
├ 测试数据 02:答案正确... (0ms, 696KB)
├ 测试数据 03:答案正确... (0ms, 696KB)
├ 测试数据 04:答案正确... (0ms, 696KB)
├ 测试数据 05:答案正确... (117ms, 696KB)
├ 测试数据 06:答案正确... (0ms, 696KB)
├ 测试数据 07:答案正确... (0ms, 696KB)
├ 测试数据 08:答案正确... (0ms, 696KB)
├ 测试数据 09:答案正确... (0ms, 696KB)
├ 测试数据 10:答案正确... (0ms, 696KB)---|---|---|---|---|---|---|---|-
Accepted / 100 / 117ms / 696KB
一看时限2s,我就写了个暴力数据好弱,暴力有九个点都是0ms……
往下看了看,为什么都是暴力但第五个点的用时都不一样……
-
02012-10-20 18:37:23@
暴力万岁!!!!
var
i,j,n,ans:longint;
a:array[1..15000,1..2]of longint;
b:array[0..14999]of longint;
begin
readln(n);
for i:=1 to n do
begin
readln(a,a);
end;
for i:=1 to n do
begin
ans:=0;
for j:=1 to n do
begin
if ji then
if (a[j,1] -
02012-08-04 00:13:17@
咱的做法即使数据不水也能过,且编程复杂度低下
var
n,i,j:longint;
x,y,ans,f:array[0..15000] of longint;
procedure qsort(l,r:longint);
var
i,j,temp,mid,midy:longint;
begin
i:=l; j:=r;
mid:=x[(l+r) div 2]; midy:=y[(l+r) div 2];
repeat
while (x[i]midy)) do dec(j);
if ij;
if j>l then qsort(l,j);
if r>i then qsort(i,r);
end;
begin
readln(n);
for i:=1 to n do readln(x[i],y[i]);
qsort(1,n);
for i:=1 to n-1 do
for j:=i+1 to n do
if (y[j]>=y[i]) then inc(ans[j]);
for i:=1 to n do
inc(f[ans[i]]);
for i:=0 to n-1 do writeln(f[i]);
end. -
02012-08-02 10:17:59@
点击这里查看
-
02012-07-29 10:11:11@
一开始用二维数组模拟了地图结果255错误。。郁闷ING
后来用了个稍微好点的方法。。。但没秒杀
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 103ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:103ms
var map:array[1..3,1..15000] of integer;
n,x,y,i,j,k:integer;
jilu:array[0..15000] of integer;
begin
readln(n);
for i:=1 to n do
readln(map[1,i],map[2,i]);
for j:=1 to n do
for k:=1 to n do
if (map[1,j]>=map[1,k]) and (map[2,j]>=map[2,k]) then inc(map[3,j]);
for x:=1 to n do
begin
y:=map[3,x]-1;
inc(jilu[y]);
end;
for x:=0 to n-1 do
writeln(jilu[x]);
end. -
02010-07-01 23:09:24@
测试数据 05:答案正确... 462ms
-
02010-04-08 19:35:18@
const maxn=15030;
var num,ans,x,y:array [0..maxn] of integer;
k,i,j,n:integer;
begin
readln(n);
for i:=1 to n do
readln(x[i],y[i]);
for i:=1 to n do
for j:=1 to n do
if (x[i]>=x[j]) and (y[i]>=y[j])
then num[i]:=num[i]+1;
for i:=1 to n do
for j:=0 to n-1 do begin ans[j]:=0; for j:=1 to n do
if num[i]=j then ans[j]:=ans[j]+1; end;
for i:=1 to n do
writeln(ans[i]);
end. -
02009-11-11 17:12:13@
Accepted 有效得分:100 有效耗时:0ms
n不是小于15000吗》?
怎么我的O(n^2)也秒。。。数据太弱了吧。。 -
02009-11-10 16:08:17@
我菜了,我的树状数组被华丽丽的秒杀,暴搜反而过了,我是沙茶...
-
02009-11-09 15:14:22@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms树状数组 秒杀
此题充满蹊跷
无语了好久 -
02009-11-03 20:28:14@
NB!
开始以为不会这么简单
没想到...
实施暴力...
2分钟编完了...
以外的"AC"了
"AC"的感觉没意思 -
02009-11-01 15:40:18@
有些题目有多种解法,但有的时候最简单的写法往往是最高效的。
所以不要想得太复杂。
——这是我从比赛中得到的经验 -
02009-10-31 19:36:17@
数据太弱了!
-
02009-10-30 11:54:48@
一个线段树的参考
另外事实证明
没有重叠的坐标编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msprogram Agent;typenode=recordw:longint;left,right,lch,rch:longint;end;varn,tn,max:longint;tree:array[1..100000]of node;cln:array[1..15010]of longint;xi,yi:array[1..15010]of longint;procedure qsort(l,r:longint);vari,x,y,z1,z2,t:longint;beginx:=l;y:=r;z1:=xi[(x+y) div 2];z2:=yi[(x+y) div 2];repeatwhile (yi[x]z1)) do dec(y);if xy;if x=tree[v].left) and (k=tree[tree[v].rch].left then insert(tree[v].rch,k);if k=tree[tree[v].rch].left) and (lmax then max:=xi[i]; if yi[i]>max then max:=yi[i]; end;end;procedure main;vari,x,y:longint;beginbuildtree(1,max);qsort(1,n);for i:= 1 to n do begin inc(cln[find(1,xi[i],1)]); insert(1,xi[i]); end;for i:= 0 to n-1 do writeln(cln[i]);end;beginassign(input,'input.txt');reset(input);assign(output,'output.txt');rewrite(output);init;main;close(input);close(output);end.
-
02009-10-23 17:07:16@
type
stack=record
x:longint;
y:longint;
end;
var a :array[1..15000]of stack;
b :array[0..15000]of longint;
n,i,j,t :longint;procedure qsort(l,r:longint);
var i,j,x,y :longint;
t :stack;
begin
i:=l;j:=r;x:=a[(l+r)div 2].x;y:=a[(l+r)div 2].y;
repeat
while (a[i].x>x)or((a[i].x=x)and(a[i].y>y)) do inc(i);
while (a[j].xj;
if l -
02009-10-21 22:54:32@
线段树华丽的AC
#include
#include
#include
using namespace std;
struct Seg
{
int left,right,tot;
}a[1000000];
struct Type
{
int x,y;
}b[1000000];
int cmp(const void *a,const void b)
{
Type x,y;
x=(Type )a; y=(Type *)b;
if(x.y==y.y) return x.x-y.x;
return x.y-y.y;
}
void build(int k,int l,int r)
{
a[k].left=l;
a[k].right=r;
if(l==r) return;
int mid=(l+r)>>1;
build(k*2,l,mid);
build(k*2+1,mid+1,r);
}
void insert(int x0,int k)
{
if(x0>a[k].right||x0a[k].right||r -
02009-10-21 22:47:43@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 150ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:150ms
水题啊!!!