File tree 4 files changed +26
-38
lines changed
4 files changed +26
-38
lines changed Original file line number Diff line number Diff line change 1
- // ! Remove define before submitting !
2
- #define local
3
-
4
- #ifndef local
1
+ #ifdef REMOTE_JUDGE
5
2
#include " solution.h"
6
3
#endif
7
4
5
+ #include < iostream>
8
6
9
- #ifdef local
7
+ #ifndef REMOTE_JUDGE
10
8
11
9
#include < string>
12
10
13
11
struct Node {
14
12
std::string value;
15
13
Node* next;
16
- Node (const std::string &value, Node* next);
14
+ Node (const std::string &value, Node* next) : value(value), next(next) {}
17
15
};
18
16
19
17
#endif
20
18
19
+
21
20
void solution (Node* head) {
22
21
// Your code
23
22
// ヽ(´▽`)/
23
+ while (head) {
24
+ std::cout << head->value << std:: endl;
25
+ head = head->next ;
26
+ }
24
27
}
25
28
29
+ #ifndef REMOTE_JUDGE
26
30
void test () {
27
31
Node node3 (" node3" , nullptr );
28
32
Node node2 (" node2" , &node3);
@@ -36,4 +40,9 @@ void test() {
36
40
node2
37
41
node3
38
42
*/
39
- }
43
+ }
44
+
45
+ int main () {
46
+ test ();
47
+ }
48
+ #endif
Original file line number Diff line number Diff line change 1
- // ! Remove define before submitting !
2
- #define local
3
-
4
- #ifndef local
1
+ #ifdef REMOTE_JUDGE
5
2
#include " solution.h"
6
3
#endif
7
- #ifdef local
4
+
5
+ #ifndef REMOTE_JUDGE
8
6
#include < cassert>
9
7
#include < string>
10
- #endif
11
-
12
-
13
-
14
- #ifdef local
15
8
16
9
struct Node {
17
10
std::string value;
@@ -28,7 +21,7 @@ Node* solution(Node* head, int idx) {
28
21
// ヽ(´▽`)/
29
22
}
30
23
31
- #ifdef local
24
+ #ifndef REMOTE_JUDGE
32
25
void test () {
33
26
Node node3 (" node3" , nullptr );
34
27
Node node2 (" node2" , &node3);
Original file line number Diff line number Diff line change 1
- // ! Remove define before submitting !
2
- #define local
3
-
4
- #ifndef local
1
+ #ifdef REMOTE_JUDGE
5
2
#include " solution.h"
6
3
#endif
7
4
8
- #ifdef local
5
+ #ifndef REMOTE_JUDGE
9
6
#include < cassert>
10
7
#include < string>
11
- #endif
12
-
13
-
14
-
15
- #ifdef local
16
8
17
9
struct Node {
18
10
std::string value;
@@ -29,7 +21,7 @@ int solution(Node* head, const std::string& elem) {
29
21
// ヽ(´▽`)/
30
22
}
31
23
32
- #ifdef local
24
+ #ifndef REMOTE_JUDGE
33
25
void test () {
34
26
Node node3 (" node3" , nullptr );
35
27
Node node2 (" node2" , &node3);
Original file line number Diff line number Diff line change 1
- // ! Remove define before submitting !
2
- #define local
3
-
4
- #ifndef local
1
+ #ifdef REMOTE_JUDGE
5
2
#include " solution.h"
6
3
#endif
7
4
8
- #ifdef local
5
+ #ifndef REMOTE_JUDGE
9
6
#include < cassert>
10
7
#include < string>
11
- #endif
12
-
13
8
14
- #ifdef local
15
9
struct Node {
16
10
Node (const std::string &value, Node* next, Node* prev)
17
11
: value(value)
@@ -29,7 +23,7 @@ Node* solution(Node* head) {
29
23
// ヽ(´▽`)/
30
24
}
31
25
32
- #ifdef local
26
+ #ifndef REMOTE_JUDGE
33
27
void test () {
34
28
Node node3 (" node3" , nullptr , nullptr );
35
29
Node node2 (" node2" , nullptr , nullptr );
You can’t perform that action at this time.
0 commit comments