File tree 3 files changed +74
-0
lines changed
3 files changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+
5
+ int const N = 2e5 + 10 ;
6
+ int n, m, k;
7
+ bool vis[N];
8
+ vector<vector<int > > g;
9
+ vector<int > sol;
10
+
11
+ void DFS (int v, int src) {
12
+ vis[v] = true ;
13
+ sol.push_back (v);
14
+
15
+ for (int i = 0 ; i < (int )g[v].size (); ++i) {
16
+ int u = g[v][i];
17
+ if (u == src && sol.size () >= k + 1 ) {
18
+ printf (" %d\n " , (int )sol.size ());
19
+ for (int j = 0 ; j < (int )sol.size (); ++j)
20
+ printf (" %d " , sol[j]);
21
+ puts (" " );
22
+ exit (0 );
23
+ }
24
+ if (!vis[u])
25
+ DFS (u, src);
26
+ }
27
+
28
+ sol.pop_back ();
29
+ }
30
+
31
+ int main () {
32
+ scanf (" %d %d %d" , &n, &m, &k);
33
+ g.resize (n + 10 );
34
+ for (int i = 0 , a, b; i < m; ++i) {
35
+ scanf (" %d %d" , &a, &b);
36
+ g[a].push_back (b);
37
+ swap (a, b);
38
+ g[a].push_back (b);
39
+ }
40
+ for (int i = 0 ; i < (int )g.size (); ++i)
41
+ sort (g[i].begin (), g[i].end ());
42
+
43
+ for (int i = 1 ; i < n; ++i) {
44
+ memset (vis, false , sizeof vis);
45
+ DFS (i, i);
46
+ }
47
+
48
+ return 0 ;
49
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+
5
+ char in[int (2e5 + 10 )], out[int (2e5 + 10 )];
6
+
7
+ int main () {
8
+ scanf (" %s" , in + 5 );
9
+ int len = strlen (in + 5 ), cnt = 5 ;
10
+ for (int i = 0 ; i < 5 ; ++i)
11
+ out[i] = char (i + ' 0' );
12
+ for (int i = 5 ; i < len + 5 ; ++i) {
13
+ if (out[cnt - 1 ] == in[i] && out[cnt - 2 ] == in[i])
14
+ continue ;
15
+ if (out[cnt - 3 ] == out[cnt - 2 ] && out[cnt - 1 ] == in[i])
16
+ continue ;
17
+ out[cnt++] = in[i];
18
+ }
19
+ out[cnt] = ' \0 ' ;
20
+ printf (" %s\n " , out + 5 );
21
+
22
+ return 0 ;
23
+ }
Original file line number Diff line number Diff line change 75
75
- [ 257A. Sockets] ( http://codeforces.com/contest/257/problem/A )
76
76
- [ 262A. Roma and Lucky Numbers] ( http://codeforces.com/problemset/problem/262/A )
77
77
- [ 263A. Beautiful Matrix] ( http://codeforces.com/problemset/problem/263/A )
78
+ - [ 263D. Cycle in Graph] ( http://codeforces.com/contest/263/problem/D )
78
79
- [ 266A. Stones on the Table] ( http://codeforces.com/problemset/problem/266/A )
79
80
- [ 266B. Queue at the School] ( http://codeforces.com/problemset/problem/266/B )
80
81
- [ 268A. Games] ( http://codeforces.com/problemset/problem/268/A )
96
97
- [ 358A. Dima and Continuous Line] ( http://codeforces.com/problemset/problem/358/A )
97
98
- [ 359D. Pair of Numbers] ( http://codeforces.com/contest/359/problem/D )
98
99
- [ 363B. Fence] ( http://codeforces.com/contest/363/problem/B )
100
+ - [ 363C. Fixing Typos] ( http://codeforces.com/contest/363/problem/C )
99
101
- [ 368A. Sereja and Coat Rack] ( http://codeforces.com/problemset/problem/368/A )
100
102
- [ 368B. Sereja and Suffixes] ( http://codeforces.com/problemset/problem/368/B )
101
103
- [ 378A. Playing with Dice] ( http://codeforces.com/problemset/problem/378/A )
You can’t perform that action at this time.
0 commit comments