44#include < string>
55#include < iostream>
66#include < fstream>
7- #include " jsoncpp/json.h"
7+ #include " ../ jsoncpp/json.h"
88
99#define rep (i, l, r ) for (int i=l; i<=r; i++)
1010#define dow (i, l, r ) for (int i=l; i>=r; i--)
@@ -92,7 +92,7 @@ inline void ChangetoPosition(int a)
9292inline void ReadInput (const char *localFileName) // 读入JSON
9393{
9494 string str, chunk;
95-
95+
9696 if (localFileName)
9797 {
9898 ifstream fin (localFileName);
@@ -105,11 +105,11 @@ inline void ChangetoPosition(int a)
105105 }
106106 else
107107 while (getline (cin, chunk) && chunk != " " ) str += chunk;
108-
108+
109109 Json::Reader reader;
110110 Json::Value input;
111111 reader.parse (str, input);
112-
112+
113113 Json::Value::Members arrayMember = input[" portals" ][" idOthers" ][" bkmrk" ].getMemberNames ();
114114 for (Json::Value::Members::iterator iter = arrayMember.begin (); iter != arrayMember.end (); ++iter)
115115 {
@@ -164,7 +164,7 @@ inline void AddLine(int a, int b)
164164 dt[Ltot][" latLngs" ][1 ][" lng" ] = D_toString (P[b].y0 );
165165 dt[Ltot][" color" ] = " #0099FF" ;
166166 dt[Ltot][" type" ] = " polyline" ;
167-
167+
168168 Ltot++;
169169}
170170
@@ -173,7 +173,7 @@ inline void AddPortal(int a)
173173 bm[" portals" ][" idOthers" ][" bkmrk" ][I_toString (Ptot)][" guid" ] = P[a].guid ;
174174 bm[" portals" ][" idOthers" ][" bkmrk" ][I_toString (Ptot)][" latlng" ] = P[a].latlng ;
175175 bm[" portals" ][" idOthers" ][" bkmrk" ][I_toString (Ptot)][" label" ] = P[a].label ;
176-
176+
177177 Ptot++;
178178}
179179
@@ -190,15 +190,15 @@ inline void AddPortal(int a)
190190inline void OutputResult ()
191191{
192192 freopen (" baf-result.txt" , " w" , stdout);
193-
193+
194194 AddLine (1 ,2 ); AddPortal (1 ); AddPortal (2 );
195-
195+
196196 while (Ans) AddLine (Ans,1 ), AddLine (Ans,2 ), AddPortal (Ans), Ans=nx[Ans];
197-
197+
198198 Json::FastWriter writer;
199199 puts (" Bookmarks JSON:" ); cout << writer.write (bm) << endl;
200200 puts (" DrawTools JSON:" ); cout << writer.write (dt) << endl;
201-
201+
202202 fclose (stdout);
203203}
204204
@@ -216,28 +216,28 @@ inline void OutputResult()
216216int main ()
217217{
218218 ReadInput (" portal.txt" );
219-
219+
220220 system (" cls" ); printf (" 总点数:%d\n 倒数第二个 Portal:" , n); cout << P[n-1 ].label << endl;
221221 getchar ();
222-
222+
223223 if (n>maxn-9 )
224224 {
225225 puts (" 点数过多,请删减。" );
226226 getchar (); return 0 ;
227227 }
228-
228+
229229 rep (i, 3 , n) P[i].S =Area (1 ,2 ,i);
230230 sort (P+1 , P+1 +n, cmpS);
231-
231+
232232 Ans=0 ; rep (i, 3 , n)
233233 {
234234 Level[i]=1 , nx[i]=0 ;
235235 rep (j, 3 , i-1 ) if (inField (1 ,2 ,i,j) && Level[i]<Level[j]+1 ) Level[i]=Level[j]+1 , nx[i]=j;
236236 if (!Ans || Level[Ans]<Level[i]) Ans=i;
237237 }
238-
238+
239239 OutputResult ();
240-
240+
241241 return 0 ;
242242}
243243
0 commit comments