QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#254128#7680. Subwayucup-team134#WA 1ms4148kbC++174.5kb2023-11-18 01:21:232023-11-18 01:21:24

Judging History

你现在查看的是最新测评结果

  • [2023-11-18 01:21:24]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4148kb
  • [2023-11-18 01:21:23]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ld long double
#define li __int128

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<int D, typename T>struct vec : public vector<vec<D - 1, T>> {template<typename... Args>vec(int n = 0, Args... args) : vector<vec<D - 1, T>>(n, vec<D - 1, T>(args...)) {}};
template<typename T>struct vec<1, T> : public vector<T> {vec(int n = 0, T val = T()) : vector<T>(n, val) {}};
template<class T1,class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;}
template<class T> ostream& operator<<(ostream& os, const deque<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;}
template<class T> ostream& operator<<(ostream& os, const set<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T> ostream& operator<<(ostream& os, const set<T,greater<T> >& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T> ostream& operator<<(ostream& os, const multiset<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T> ostream& operator<<(ostream& os, const multiset<T,greater<T> >& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T1,class T2> ostream& operator<<(ostream& os, const map<T1,T2>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
int ri(){int x;scanf("%i",&x);return x;}
void rd(int&x){scanf("%i",&x);}
void rd(long long&x){scanf("%lld",&x);}
void rd(double&x){scanf("%lf",&x);}
void rd(long double&x){scanf("%Lf",&x);}
void rd(string&x){cin>>x;}
void rd(char*x){scanf("%s",x);}
template<typename T1,typename T2>void rd(pair<T1,T2>&x){rd(x.first);rd(x.second);}
template<typename T>void rd(vector<T>&x){for(T&p:x)rd(p);}
template<typename C,typename...T>void rd(C&a,T&...args){rd(a);rd(args...);}
//istream& operator>>(istream& is,__int128& a){string s;is>>s;a=0;int i=0;bool neg=false;if(s[0]=='-')neg=true,i++;for(;i<s.size();i++)a=a*10+s[i]-'0';if(neg)a*=-1;return is;}
//ostream& operator<<(ostream& os,__int128 a){bool neg=false;if(a<0)neg=true,a*=-1;ll high=(a/(__int128)1e18);ll low=(a-(__int128)1e18*high);string res;if(neg)res+='-';if(high>0){res+=to_string(high);string temp=to_string(low);res+=string(18-temp.size(),'0');res+=temp;}else res+=to_string(low);os<<res;return os;}

int main()
{
	int n=ri();
	vector<pair<pair<int,int>,int>> ok;
	int l=0;
	for(int i=0;i<n;i++){
		int x=ri(),y=ri(),a=ri();
		ok.pb({{y,x},a});
		l=max(l,a);
	}
	sort(all(ok));
	int X=1e8;
	int Y=-1001;
	vector<vector<pair<int,int>>> lines(l);
	vector<int> lastStation(l,-1);
	vector<int> sty;
	vector<int> stx;
	for(int i=0;i<n;i++){
		int x=ok[i].f.s,y=ok[i].f.f;
		int a=ok[i].s;
		sty.pb(Y-1);
		int stX=X-1;
		stx.pb(stX);
		for(int j=0;j<a;j++){
			int lind=j;
			if(lastStation[lind]!=-1){ //jump!
				if(lastStation[lind]==i-1){
					lines[lind].pb({stx[i],sty[i]});
					sty[i]--;
				}
				else{
					int yy=0;
					for(int k=i;k>lastStation[lind];k--){
						yy=min(yy,sty[k]);
					}
					for(int k=i;k>lastStation[lind];k--){
						sty[k]=yy+1;
					}
					lines[lind].pb({stx[lastStation[lind]+1],yy});
					lines[lind].pb({stx[i],yy});
				}
			}
			lines[lind].pb({X,Y});
			lines[lind].pb({x,y});
			X+=2;
		}
		for(int j=0;j<a;j++){
			int lind=a-j-1;
			lines[lind].pb({X,Y});
			X+=2;
			lastStation[lind]=i;
		}
	}
	printf("%i\n",l);
	for(int i=0;i<l;i++){
		printf("%i",sz(lines[i]));
		for(auto p:lines[i])printf(" %i %i",p.f,p.s);
		printf("\n");
	}
	
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3872kb

input:

3
1 2 1
2 1 2
3 3 2

output:

2
11 100000000 -1001 2 1 100000006 -1001 100000007 -1002 100000008 -1001 1 2 100000010 -1001 100000011 -1002 100000012 -1001 3 3 100000018 -1001
8 100000002 -1001 2 1 100000004 -1001 100000007 -1003 100000011 -1003 100000014 -1001 3 3 100000016 -1001

result:

ok ok Sum L = 19

Test #2:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

1
1 1 1

output:

1
3 100000000 -1001 1 1 100000002 -1001

result:

ok ok Sum L = 3

Test #3:

score: 0
Accepted
time: 0ms
memory: 4036kb

input:

1
1 1 50

output:

50
3 100000000 -1001 1 1 100000198 -1001
3 100000002 -1001 1 1 100000196 -1001
3 100000004 -1001 1 1 100000194 -1001
3 100000006 -1001 1 1 100000192 -1001
3 100000008 -1001 1 1 100000190 -1001
3 100000010 -1001 1 1 100000188 -1001
3 100000012 -1001 1 1 100000186 -1001
3 100000014 -1001 1 1 100000184...

result:

ok ok Sum L = 150

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 4148kb

input:

50
662 -567 48
728 -120 7
307 669 27
-885 -775 21
100 242 9
-784 -537 41
940 198 46
736 -551 30
-449 456 16
-945 382 18
-182 810 49
213 187 44
853 245 48
617 -305 19
-81 261 3
617 208 8
-548 -652 6
-888 -667 14
-371 -812 43
202 -702 10
-668 -725 5
961 -919 33
-870 -697 50
428 810 29
560 405 7
348 -3...

output:

50
199 100000000 -1001 961 -919 100000130 -1001 100000131 -1002 100000132 -1001 -306 -897 100000302 -1001 100000303 -1002 100000304 -1001 334 -893 100000334 -1001 100000335 -1002 100000336 -1001 -371 -812 100000506 -1001 100000507 -1002 100000508 -1001 -885 -775 100000590 -1001 100000591 -1002 10000...

result:

wrong answer Polyline 3 intersects with previous polylines.