結果
| 問題 |
No.479 頂点は要らない
|
| コンテスト | |
| ユーザー |
fal_rnd
|
| 提出日時 | 2017-01-27 23:23:15 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 879 bytes |
| コンパイル時間 | 4,334 ms |
| コンパイル使用メモリ | 80,244 KB |
| 実行使用メモリ | 76,716 KB |
| 最終ジャッジ日時 | 2024-12-16 18:18:01 |
| 合計ジャッジ時間 | 29,229 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 TLE * 2 |
ソースコード
package yukicodercontest155;
import java.util.*;
public class D{
static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
int n=s.nextInt(),m=s.nextInt();
BitSet b=new BitSet(n);
PriorityQueue<Edge> queue = new PriorityQueue<>();
for(int i=0;i<m;i++) {
queue.add(new Edge(s.nextInt(), s.nextInt()));
}
boolean buf;
for(int i=n-1;i>=0;i--) {
buf=b.get(i);
while((!queue.isEmpty())&&i==queue.peek().t) {
if(!buf)
b.set(queue.poll().s);
else
queue.poll();
}
}
for(int i=b.previousSetBit(114514);i>=0;i--) {
System.out.print(b.get(i)?1:0);
}
System.out.println();
}
}
class Edge implements Comparable<Edge>{
int s,t;
Edge(int s,int t) {
this.s=s;
this.t=t;
}
@Override
public int compareTo(Edge o) {
return o.t-this.t;
}
@Override
public String toString() {
return ""+s+" "+t;
}
}
fal_rnd